src/share/classes/javax/print/MimeType.java

Print this page

        

*** 115,136 **** private transient ParameterMap myParameterMap = null; /** * Parameter map entry. */ ! private class ParameterMapEntry implements Map.Entry { private int myIndex; public ParameterMapEntry(int theIndex) { myIndex = theIndex; } ! public Object getKey(){ return myPieces[myIndex]; } ! public Object getValue(){ return myPieces[myIndex+1]; } ! public Object setValue (Object value) { throw new UnsupportedOperationException(); } public boolean equals(Object o) { return (o != null && o instanceof Map.Entry && --- 115,136 ---- private transient ParameterMap myParameterMap = null; /** * Parameter map entry. */ ! private class ParameterMapEntry implements Map.Entry<String, String> { private int myIndex; public ParameterMapEntry(int theIndex) { myIndex = theIndex; } ! public String getKey(){ return myPieces[myIndex]; } ! public String getValue(){ return myPieces[myIndex+1]; } ! public String setValue (String value) { throw new UnsupportedOperationException(); } public boolean equals(Object o) { return (o != null && o instanceof Map.Entry &&
*** 143,158 **** } /** * Parameter map entry set iterator. */ ! private class ParameterMapEntrySetIterator implements Iterator { private int myIndex = 2; public boolean hasNext() { return myIndex < myPieces.length; } ! public Object next() { if (hasNext()) { ParameterMapEntry result = new ParameterMapEntry (myIndex); myIndex += 2; return result; } else { --- 143,158 ---- } /** * Parameter map entry set iterator. */ ! private class ParameterMapEntrySetIterator implements Iterator<Map.Entry<String, String>> { private int myIndex = 2; public boolean hasNext() { return myIndex < myPieces.length; } ! public Map.Entry<String, String> next() { if (hasNext()) { ParameterMapEntry result = new ParameterMapEntry (myIndex); myIndex += 2; return result; } else {
*** 165,188 **** } /** * Parameter map entry set. */ ! private class ParameterMapEntrySet extends AbstractSet { ! public Iterator iterator() { return new ParameterMapEntrySetIterator(); } public int size() { return (myPieces.length - 2) / 2; } } /** * Parameter map. */ ! private class ParameterMap extends AbstractMap { ! public Set entrySet() { if (myEntrySet == null) { myEntrySet = new ParameterMapEntrySet(); } return myEntrySet; } --- 165,188 ---- } /** * Parameter map entry set. */ ! private class ParameterMapEntrySet extends AbstractSet<Map.Entry<String, String>> { ! public Iterator<Map.Entry<String, String>> iterator() { return new ParameterMapEntrySetIterator(); } public int size() { return (myPieces.length - 2) / 2; } } /** * Parameter map. */ ! private class ParameterMap extends AbstractMap<String, String> { ! public Set<Map.Entry<String, String>> entrySet() { if (myEntrySet == null) { myEntrySet = new ParameterMapEntrySet(); } return myEntrySet; }
*** 232,242 **** * name String (key) mapping to a parameter value String. If this MIME * type object has no parameters, an empty map is returned. * * @return Parameter map for this MIME type object. */ ! public Map getParameterMap() { if (myParameterMap == null) { myParameterMap = new ParameterMap(); } return myParameterMap; } --- 232,242 ---- * name String (key) mapping to a parameter value String. If this MIME * type object has no parameters, an empty map is returned. * * @return Parameter map for this MIME type object. */ ! public Map<String, String> getParameterMap() { if (myParameterMap == null) { myParameterMap = new ParameterMap(); } return myParameterMap; }
*** 546,556 **** if (s == null) { throw new NullPointerException(); } LexicalAnalyzer theLexer = new LexicalAnalyzer (s); int theLexemeType; ! Vector thePieces = new Vector(); boolean mediaTypeIsText = false; boolean parameterNameIsCharset = false; // Parse media type. if (theLexer.getLexemeType() == TOKEN_LEXEME) { --- 546,556 ---- if (s == null) { throw new NullPointerException(); } LexicalAnalyzer theLexer = new LexicalAnalyzer (s); int theLexemeType; ! Vector<String> thePieces = new Vector<>(); boolean mediaTypeIsText = false; boolean parameterNameIsCharset = false; // Parse media type. if (theLexer.getLexemeType() == TOKEN_LEXEME) {
*** 621,631 **** throw new IllegalArgumentException(); } // Save the pieces. Parameters are not in ascending order yet. int n = thePieces.size(); ! myPieces = (String[]) thePieces.toArray (new String [n]); // Sort the parameters into ascending order using an insertion sort. int i, j; String temp; for (i = 4; i < n; i += 2) { --- 621,631 ---- throw new IllegalArgumentException(); } // Save the pieces. Parameters are not in ascending order yet. int n = thePieces.size(); ! myPieces = thePieces.toArray (new String [n]); // Sort the parameters into ascending order using an insertion sort. int i, j; String temp; for (i = 4; i < n; i += 2) {