/** * Returns an immutable case-insensitive map from canonical names to {@code Charset} instances. * If multiple charsets have the same canonical name, it is unspecified which is returned in * the map. This method may be slow. If you know which charset you're looking for, use * {@link #forName}. */ public static SortedMap<String, Charset> availableCharsets() { // Start with a copy of the built-in charsets... TreeMap<String, Charset> charsets = new TreeMap<String, Charset>(String.CASE_INSENSITIVE_ORDER); for (String charsetName : NativeConverter.getAvailableCharsetNames()) { // RoboVM note: Added try-catch to ignore charsets with bad names (e.g. "x-UTF-16,version=1") try { Charset charset = NativeConverter.charsetForName(charsetName); charsets.put(charset.name(), charset); } catch (IllegalCharsetNameException e) { } } // Add all charsets provided by all charset providers... for (CharsetProvider charsetProvider : ServiceLoader.load(CharsetProvider.class)) { Iterator<Charset> it = charsetProvider.charsets(); while (it.hasNext()) { Charset cs = it.next(); // A CharsetProvider can't override a built-in Charset. if (!charsets.containsKey(cs.name())) { charsets.put(cs.name(), cs); } } } return Collections.unmodifiableSortedMap(charsets); }
cs = NativeConverter.charsetForName(charsetName); if (cs != null) { return cacheCharset(charsetName, cs);
/** * Returns an immutable case-insensitive map from canonical names to {@code Charset} instances. * If multiple charsets have the same canonical name, it is unspecified which is returned in * the map. This method may be slow. If you know which charset you're looking for, use * {@link #forName}. */ public static SortedMap<String, Charset> availableCharsets() { // Start with a copy of the built-in charsets... TreeMap<String, Charset> charsets = new TreeMap<String, Charset>(String.CASE_INSENSITIVE_ORDER); for (String charsetName : NativeConverter.getAvailableCharsetNames()) { // BugVM note: Added try-catch to ignore charsets with bad names (e.g. "x-UTF-16,version=1") try { Charset charset = NativeConverter.charsetForName(charsetName); charsets.put(charset.name(), charset); } catch (IllegalCharsetNameException e) { } } // Add all charsets provided by all charset providers... for (CharsetProvider charsetProvider : ServiceLoader.load(CharsetProvider.class)) { Iterator<Charset> it = charsetProvider.charsets(); while (it.hasNext()) { Charset cs = it.next(); // A CharsetProvider can't override a built-in Charset. if (!charsets.containsKey(cs.name())) { charsets.put(cs.name(), cs); } } } return Collections.unmodifiableSortedMap(charsets); }
/** * Returns an immutable case-insensitive map from canonical names to {@code Charset} instances. * If multiple charsets have the same canonical name, it is unspecified which is returned in * the map. This method may be slow. If you know which charset you're looking for, use * {@link #forName}. */ public static SortedMap<String, Charset> availableCharsets() { // Start with a copy of the built-in charsets... TreeMap<String, Charset> charsets = new TreeMap<String, Charset>(String.CASE_INSENSITIVE_ORDER); for (String charsetName : NativeConverter.getAvailableCharsetNames()) { // RoboVM note: Added try-catch to ignore charsets with bad names (e.g. "x-UTF-16,version=1") try { Charset charset = NativeConverter.charsetForName(charsetName); charsets.put(charset.name(), charset); } catch (IllegalCharsetNameException e) { } } // Add all charsets provided by all charset providers... for (CharsetProvider charsetProvider : ServiceLoader.load(CharsetProvider.class)) { Iterator<Charset> it = charsetProvider.charsets(); while (it.hasNext()) { Charset cs = it.next(); // A CharsetProvider can't override a built-in Charset. if (!charsets.containsKey(cs.name())) { charsets.put(cs.name(), cs); } } } return Collections.unmodifiableSortedMap(charsets); }
/** * Returns an immutable case-insensitive map from canonical names to {@code Charset} instances. * If multiple charsets have the same canonical name, it is unspecified which is returned in * the map. This method may be slow. If you know which charset you're looking for, use * {@link #forName}. */ public static SortedMap<String, Charset> availableCharsets() { // Start with a copy of the built-in charsets... TreeMap<String, Charset> charsets = new TreeMap<String, Charset>(String.CASE_INSENSITIVE_ORDER); for (String charsetName : NativeConverter.getAvailableCharsetNames()) { // RoboVM note: Added try-catch to ignore charsets with bad names (e.g. "x-UTF-16,version=1") try { Charset charset = NativeConverter.charsetForName(charsetName); charsets.put(charset.name(), charset); } catch (IllegalCharsetNameException e) { } } // Add all charsets provided by all charset providers... for (CharsetProvider charsetProvider : ServiceLoader.load(CharsetProvider.class)) { Iterator<Charset> it = charsetProvider.charsets(); while (it.hasNext()) { Charset cs = it.next(); // A CharsetProvider can't override a built-in Charset. if (!charsets.containsKey(cs.name())) { charsets.put(cs.name(), cs); } } } return Collections.unmodifiableSortedMap(charsets); }
/** * Returns an immutable case-insensitive map from canonical names to {@code Charset} instances. * If multiple charsets have the same canonical name, it is unspecified which is returned in * the map. This method may be slow. If you know which charset you're looking for, use * {@link #forName}. */ public static SortedMap<String, Charset> availableCharsets() { // Start with a copy of the built-in charsets... TreeMap<String, Charset> charsets = new TreeMap<String, Charset>(String.CASE_INSENSITIVE_ORDER); for (String charsetName : NativeConverter.getAvailableCharsetNames()) { // RoboVM note: Added try-catch to ignore charsets with bad names (e.g. "x-UTF-16,version=1") try { Charset charset = NativeConverter.charsetForName(charsetName); charsets.put(charset.name(), charset); } catch (IllegalCharsetNameException e) { } } // Add all charsets provided by all charset providers... for (CharsetProvider charsetProvider : ServiceLoader.load(CharsetProvider.class)) { Iterator<Charset> it = charsetProvider.charsets(); while (it.hasNext()) { Charset cs = it.next(); // A CharsetProvider can't override a built-in Charset. if (!charsets.containsKey(cs.name())) { charsets.put(cs.name(), cs); } } } return Collections.unmodifiableSortedMap(charsets); }
/** * Returns an immutable case-insensitive map from canonical names to {@code Charset} instances. * If multiple charsets have the same canonical name, it is unspecified which is returned in * the map. This method may be slow. If you know which charset you're looking for, use * {@link #forName}. */ public static SortedMap<String, Charset> availableCharsets() { // Start with a copy of the built-in charsets... TreeMap<String, Charset> charsets = new TreeMap<String, Charset>(String.CASE_INSENSITIVE_ORDER); for (String charsetName : NativeConverter.getAvailableCharsetNames()) { // BugVM note: Added try-catch to ignore charsets with bad names (e.g. "x-UTF-16,version=1") try { Charset charset = NativeConverter.charsetForName(charsetName); charsets.put(charset.name(), charset); } catch (IllegalCharsetNameException e) { } } // Add all charsets provided by all charset providers... for (CharsetProvider charsetProvider : ServiceLoader.load(CharsetProvider.class)) { Iterator<Charset> it = charsetProvider.charsets(); while (it.hasNext()) { Charset cs = it.next(); // A CharsetProvider can't override a built-in Charset. if (!charsets.containsKey(cs.name())) { charsets.put(cs.name(), cs); } } } return Collections.unmodifiableSortedMap(charsets); }
/** * Returns an immutable case-insensitive map from canonical names to {@code Charset} instances. * If multiple charsets have the same canonical name, it is unspecified which is returned in * the map. This method may be slow. If you know which charset you're looking for, use * {@link #forName}. */ public static SortedMap<String, Charset> availableCharsets() { // Start with a copy of the built-in charsets... TreeMap<String, Charset> charsets = new TreeMap<String, Charset>(String.CASE_INSENSITIVE_ORDER); for (String charsetName : NativeConverter.getAvailableCharsetNames()) { // RoboVM note: Added try-catch to ignore charsets with bad names (e.g. "x-UTF-16,version=1") try { Charset charset = NativeConverter.charsetForName(charsetName); charsets.put(charset.name(), charset); } catch (IllegalCharsetNameException e) { } } // Add all charsets provided by all charset providers... for (CharsetProvider charsetProvider : ServiceLoader.load(CharsetProvider.class)) { Iterator<Charset> it = charsetProvider.charsets(); while (it.hasNext()) { Charset cs = it.next(); // A CharsetProvider can't override a built-in Charset. if (!charsets.containsKey(cs.name())) { charsets.put(cs.name(), cs); } } } return Collections.unmodifiableSortedMap(charsets); }
cs = NativeConverter.charsetForName(charsetName); if (cs != null) { return cacheCharset(charsetName, cs);
cs = NativeConverter.charsetForName(charsetName); if (cs != null) { return cacheCharset(charsetName, cs);
cs = NativeConverter.charsetForName(charsetName); if (cs != null) { return cacheCharset(charsetName, cs);
cs = NativeConverter.charsetForName(charsetName); if (cs != null) { return cacheCharset(charsetName, cs);
cs = NativeConverter.charsetForName(charsetName); if (cs != null) { return cacheCharset(charsetName, cs);
cs = NativeConverter.charsetForName(charsetName); if (cs != null) { return cacheCharset(charsetName, cs);