src/share/classes/sun/nio/cs/AbstractCharsetProvider.java

Print this page




 162         }
 163     }
 164 
 165     public final Iterator<Charset> charsets() {
 166 
 167         final ArrayList<String> ks;
 168         synchronized (this) {
 169             init();
 170             ks = new ArrayList<>(classMap.keySet());
 171         }
 172 
 173         return new Iterator<Charset>() {
 174                 Iterator<String> i = ks.iterator();
 175 
 176                 public boolean hasNext() {
 177                     return i.hasNext();
 178                 }
 179 
 180                 public Charset next() {
 181                     String csn = i.next();

 182                     return lookup(csn);
 183                 }

 184 
 185                 public void remove() {
 186                     throw new UnsupportedOperationException();
 187                 }
 188             };
 189     }
 190 
 191     public final String[] aliases(String charsetName) {
 192         synchronized (this) {
 193             init();
 194             return aliasNameMap.get(charsetName);
 195         }
 196     }
 197 
 198 }


 162         }
 163     }
 164 
 165     public final Iterator<Charset> charsets() {
 166 
 167         final ArrayList<String> ks;
 168         synchronized (this) {
 169             init();
 170             ks = new ArrayList<>(classMap.keySet());
 171         }
 172 
 173         return new Iterator<Charset>() {
 174                 Iterator<String> i = ks.iterator();
 175 
 176                 public boolean hasNext() {
 177                     return i.hasNext();
 178                 }
 179 
 180                 public Charset next() {
 181                     String csn = i.next();
 182                     synchronized (AbstractCharsetProvider.this) {
 183                         return lookup(csn);
 184                     }
 185                 }
 186 
 187                 public void remove() {
 188                     throw new UnsupportedOperationException();
 189                 }
 190             };
 191     }
 192 
 193     public final String[] aliases(String charsetName) {
 194         synchronized (this) {
 195             init();
 196             return aliasNameMap.get(charsetName);
 197         }
 198     }
 199 
 200 }