| Method from sun.io.Converters Detail: |
public static String getDefaultEncodingName() {
synchronized (lock) {
if (defaultEncoding == null) {
java.security.PrivilegedAction pa =
new sun.security.action.GetPropertyAction("file.encoding");
defaultEncoding = (String)java.security.AccessController.doPrivileged(pa);
}
}
return defaultEncoding;
} Deprecated! |
public static boolean isCached(int type,
String encoding) {
synchronized (lock) {
SoftReference[] srs = classCache[type];
for (int i = 0; i < CACHE_SIZE; i++) {
SoftReference sr = srs[i];
if (sr == null)
continue;
Object[] oa = (Object[])sr.get();
if (oa == null) {
srs[i] = null;
continue;
}
if (oa[1].equals(encoding))
return true;
}
return false;
}
} Deprecated! |
static Object newConverter(int type,
String enc) throws UnsupportedEncodingException {
Class c;
synchronized (lock) {
c = cache(type, enc);
if (c == null) {
c = getConverterClass(type, enc);
if (!c.getName().equals("sun.io.CharToByteUTF8"))
cache(type, enc, c);
}
}
return newConverter(enc, c);
} Deprecated!Create a converter object that implements the given type of converter
for the given encoding, or throw an UnsupportedEncodingException if no
appropriate converter class can be found and instantiated |
static Object newDefaultConverter(int type) {
Class c;
synchronized (lock) {
c = getDefaultConverterClass(type);
}
try {
return newConverter("", c);
} catch (UnsupportedEncodingException x) {
throw new InternalError("Cannot instantiate default converter"
+ " class " + c.getName());
}
} Deprecated!Create a converter object that implements the given type of converter
for the default encoding, falling back to ISO 8859-1 if the default
encoding cannot be determined. |
public static void resetDefaultEncodingName() {
// This method should only be called during VM initialization.
if (sun.misc.VM.isBooted())
return;
synchronized (lock) {
defaultEncoding = "ISO-8859-1";
Properties p = System.getProperties();
p.setProperty("file.encoding", defaultEncoding);
System.setProperties(p);
}
} Deprecated! |