217 |
return cs; |
return cs; |
218 |
} |
} |
219 |
|
|
220 |
public static SortedMap availableCharsets() |
public static SortedMap<String, Charset> availableCharsets() |
221 |
{ |
{ |
222 |
TreeMap charsets = new TreeMap(String.CASE_INSENSITIVE_ORDER); |
TreeMap<String, Charset> charsets |
223 |
for (Iterator i = provider().charsets(); i.hasNext(); ) |
= new TreeMap(String.CASE_INSENSITIVE_ORDER); |
224 |
|
for (Iterator<Charset> i = provider().charsets(); i.hasNext(); ) |
225 |
{ |
{ |
226 |
Charset cs = (Charset) i.next(); |
Charset cs = i.next(); |
227 |
charsets.put(cs.name(), cs); |
charsets.put(cs.name(), cs); |
228 |
} |
} |
229 |
|
|
230 |
CharsetProvider[] providers = providers2(); |
CharsetProvider[] providers = providers2(); |
231 |
for (int j = 0; j < providers.length; j++) |
for (int j = 0; j < providers.length; j++) |
232 |
{ |
{ |
233 |
for (Iterator i = providers[j].charsets(); i.hasNext(); ) |
for (Iterator<Charset> i = providers[j].charsets(); i.hasNext(); ) |
234 |
{ |
{ |
235 |
Charset cs = (Charset) i.next(); |
Charset cs = (Charset) i.next(); |
236 |
charsets.put(cs.name(), cs); |
charsets.put(cs.name(), cs); |
283 |
return canonicalName; |
return canonicalName; |
284 |
} |
} |
285 |
|
|
286 |
public final Set aliases () |
public final Set<String> aliases () |
287 |
{ |
{ |
288 |
if (aliases == null) |
if (aliases == null) |
289 |
return Collections.EMPTY_SET; |
return Collections.<String>emptySet(); |
290 |
|
|
291 |
// should we cache the aliasSet instead? |
// should we cache the aliasSet instead? |
292 |
int n = aliases.length; |
int n = aliases.length; |
293 |
HashSet aliasSet = new HashSet (n); |
HashSet<String> aliasSet = new HashSet<String> (n); |
294 |
for (int i = 0; i < n; ++i) |
for (int i = 0; i < n; ++i) |
295 |
aliasSet.add (aliases[i]); |
aliasSet.add (aliases[i]); |
296 |
return Collections.unmodifiableSet (aliasSet); |
return Collections.unmodifiableSet (aliasSet); |