[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: Ito's charset patch
Kaffe CVS
cvs-commits at kaffe.org
Sat Jan 8 14:07:50 PST 2005
PatchSet 5822
Date: 2005/01/08 22:02:35
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Resynced with GNU Classpath: Ito's charset patch
Members:
ChangeLog:1.3366->1.3367
libraries/javalib/java/nio/charset/Charset.java:1.7->1.8
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3366 kaffe/ChangeLog:1.3367
--- kaffe/ChangeLog:1.3366 Sat Jan 8 21:59:24 2005
+++ kaffe/ChangeLog Sat Jan 8 22:02:35 2005
@@ -1,6 +1,18 @@
2005-01-08 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
+
+ 2005-01-08 Ito Kazumitsu <kaz at maczuka.gcd.org>
+
+ * java/nio/charset/Charset.java (providers):
+ New method to make an array of CharsetProviders defined in
+ META-INF/services/java.nio.charset.spi.CharsetProvider.
+ (charsetForName, availableCharsets): Use the
+ new method providers().
+
+2005-01-08 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
2005-01-08 Michael Koch <konqueror at gmx.de>
Index: kaffe/libraries/javalib/java/nio/charset/Charset.java
diff -u kaffe/libraries/javalib/java/nio/charset/Charset.java:1.7 kaffe/libraries/javalib/java/nio/charset/Charset.java:1.8
--- kaffe/libraries/javalib/java/nio/charset/Charset.java:1.7 Fri Jan 7 16:28:16 2005
+++ kaffe/libraries/javalib/java/nio/charset/Charset.java Sat Jan 8 22:02:39 2005
@@ -65,6 +65,11 @@
private static CharsetEncoder cachedEncoder;
private static CharsetDecoder cachedDecoder;
+ /**
+ * Charset providers.
+ */
+ private static CharsetProvider[] providers;
+
static
{
synchronized (Charset.class)
@@ -135,68 +140,72 @@
* Retrieves a charset for the given charset name.
*
* @return A charset object for the charset with the specified name, or
- * <code>null</code> if no such charset exists.
+ * <code>null</code> if no such charset exists.
*
* @throws IllegalCharsetNameException if the name is illegal
*/
- private static Charset charsetForName (String charsetName)
+ private static Charset charsetForName(String charsetName)
{
checkName (charsetName);
Charset cs = null;
- CharsetProvider[] providers = providers ();
- for (int i = 0; i < providers.length; i++) {
- cs = providers[i].charsetForName (charsetName);
- if (cs != null) break;
- }
+ CharsetProvider[] providers = providers();
+ for (int i = 0; i < providers.length; i++)
+ {
+ cs = providers[i].charsetForName(charsetName);
+ if (cs != null)
+ break;
+ }
return cs;
}
- public static SortedMap availableCharsets ()
+ public static SortedMap availableCharsets()
{
- TreeMap charsets = new TreeMap (String.CASE_INSENSITIVE_ORDER);
+ TreeMap charsets = new TreeMap(String.CASE_INSENSITIVE_ORDER);
- CharsetProvider[] providers = providers ();
+ CharsetProvider[] providers = providers();
for (int j = 0; j < providers.length; j++)
{
- for (Iterator i = providers[j].charsets (); i.hasNext (); )
+ for (Iterator i = providers[j].charsets(); i.hasNext(); )
{
- Charset cs = (Charset) i.next ();
- charsets.put (cs.name (), cs);
+ Charset cs = (Charset) i.next();
+ charsets.put(cs.name(), cs);
}
}
- return Collections.unmodifiableSortedMap (charsets);
+ return Collections.unmodifiableSortedMap(charsets);
}
- private static CharsetProvider provider ()
+ private static CharsetProvider provider()
{
- return Provider.provider ();
+ return Provider.provider();
}
- // we need to support multiple providers, reading them from
- // java.nio.charset.spi.CharsetProvider in the resource directory
- // META-INF/services
-
- private static CharsetProvider[] providers;
- private static CharsetProvider[] providers ()
+ /**
+ * We need to support multiple providers, reading them from
+ * java.nio.charset.spi.CharsetProvider in the resource directory
+ * META-INF/services.
+ */
+ private static CharsetProvider[] providers()
{
if (providers == null)
{
try
{
- Enumeration en = ClassLoader.getSystemResources("META-INF/services/java.nio.charset.spi.CharsetProvider");
+ Enumeration en = ClassLoader.getSystemResources
+ ("META-INF/services/java.nio.charset.spi.CharsetProvider");
LinkedHashSet set = new LinkedHashSet();
- set.add(provider ());
+ set.add(provider());
while (en.hasMoreElements())
{
- BufferedReader rdr = new BufferedReader(new InputStreamReader(
- ((URL)(en.nextElement())).openStream()));
+ BufferedReader rdr = new BufferedReader(new InputStreamReader
+ (((URL) (en.nextElement())).openStream()));
while (true)
{
String s = rdr.readLine();
- if (s == null) break;
- CharsetProvider p = (CharsetProvider)(
- (Class.forName(s)).newInstance());
+ if (s == null)
+ break;
+ CharsetProvider p =
+ (CharsetProvider) ((Class.forName(s)).newInstance());
set.add(p);
}
}
More information about the kaffe
mailing list