/** * Compares this attribute name to another for equality. * @param o the object to compare * @return true if this attribute name is equal to the * specified attribute object */ public boolean equals(Object o) { if (o instanceof Name) { Comparator<String> c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER; return c.compare(name, ((Name)o).name) == 0; } else { return false; } }
/** * Computes the hash value for this attribute name. */ public int hashCode() { if (hashCode == -1) { hashCode = ASCIICaseInsensitiveComparator.lowerCaseHashCode(name); } return hashCode; }
/** * Compares this attribute name to another for equality. * @param o the object to compare * @return true if this attribute name is equal to the * specified attribute object */ public boolean equals(Object o) { if (o instanceof Name) { Comparator c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER; return c.compare(name, ((Name)o).name) == 0; } else { return false; } }
/** * Constructs a sorted map from canonical charset names to charset objects. * * <p> The map returned by this method will have one entry for each charset * for which support is available in the current Java virtual machine. If * two or more supported charsets have the same canonical name then the * resulting map will contain just one of them; which one it will contain * is not specified. </p> * * <p> The invocation of this method, and the subsequent use of the * resulting map, may cause time-consuming disk or network I/O operations * to occur. This method is provided for applications that need to * enumerate all of the available charsets, for example to allow user * charset selection. This method is not used by the {@link #forName * forName} method, which instead employs an efficient incremental lookup * algorithm. * * <p> This method may return different results at different times if new * charset providers are dynamically made available to the current Java * virtual machine. In the absence of such changes, the charsets returned * by this method are exactly those that can be retrieved via the {@link * #forName forName} method. </p> * * @return An immutable, case-insensitive map from canonical charset names * to charset objects */ public static SortedMap<String,Charset> availableCharsets() { return AccessController.doPrivileged( new PrivilegedAction<SortedMap<String,Charset>>() { public SortedMap<String,Charset> run() { TreeMap<String,Charset> m = new TreeMap<String,Charset>( ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER); put(standardProvider.charsets(), m); CharsetProvider ecp = ExtendedProviderHolder.extendedProvider; if (ecp != null) put(ecp.charsets(), m); for (Iterator<CharsetProvider> i = providers(); i.hasNext();) { CharsetProvider cp = i.next(); put(cp.charsets(), m); } return Collections.unmodifiableSortedMap(m); } }); }
/** * Constructs a sorted map from canonical charset names to charset objects. * * <p> The map returned by this method will have one entry for each charset * for which support is available in the current Java virtual machine. If * two or more supported charsets have the same canonical name then the * resulting map will contain just one of them; which one it will contain * is not specified. </p> * * <p> The invocation of this method, and the subsequent use of the * resulting map, may cause time-consuming disk or network I/O operations * to occur. This method is provided for applications that need to * enumerate all of the available charsets, for example to allow user * charset selection. This method is not used by the {@link #forName * forName} method, which instead employs an efficient incremental lookup * algorithm. * * <p> This method may return different results at different times if new * charset providers are dynamically made available to the current Java * virtual machine. In the absence of such changes, the charsets returned * by this method are exactly those that can be retrieved via the {@link * #forName forName} method. </p> * * @return An immutable, case-insensitive map from canonical charset names * to charset objects */ public static SortedMap<String,Charset> availableCharsets() { return AccessController.doPrivileged( new PrivilegedAction<SortedMap<String,Charset>>() { public SortedMap<String,Charset> run() { TreeMap<String,Charset> m = new TreeMap<String,Charset>( ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER); put(standardProvider.charsets(), m); CharsetProvider ecp = ExtendedProviderHolder.extendedProvider; if (ecp != null) put(ecp.charsets(), m); for (Iterator i = providers(); i.hasNext();) { CharsetProvider cp = (CharsetProvider)i.next(); put(cp.charsets(), m); } return Collections.unmodifiableSortedMap(m); } }); }
/** * Constructs a sorted map from canonical charset names to charset objects. * * <p> The map returned by this method will have one entry for each charset * for which support is available in the current Java virtual machine. If * two or more supported charsets have the same canonical name then the * resulting map will contain just one of them; which one it will contain * is not specified. </p> * * <p> The invocation of this method, and the subsequent use of the * resulting map, may cause time-consuming disk or network I/O operations * to occur. This method is provided for applications that need to * enumerate all of the available charsets, for example to allow user * charset selection. This method is not used by the {@link #forName * forName} method, which instead employs an efficient incremental lookup * algorithm. * * <p> This method may return different results at different times if new * charset providers are dynamically made available to the current Java * virtual machine. In the absence of such changes, the charsets returned * by this method are exactly those that can be retrieved via the {@link * #forName forName} method. </p> * * @return An immutable, case-insensitive map from canonical charset names * to charset objects */ public static SortedMap<String,Charset> availableCharsets() { return AccessController.doPrivileged( new PrivilegedAction<SortedMap<String,Charset>>() { public SortedMap<String,Charset> run() { TreeMap<String,Charset> m = new TreeMap<String,Charset>( ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER); put(standardProvider.charsets(), m); for (Iterator i = providers(); i.hasNext();) { CharsetProvider cp = (CharsetProvider)i.next(); put(cp.charsets(), m); } return Collections.unmodifiableSortedMap(m); } }); }