com.caucho.vfs
Class Encoding

java.lang.Object
  extended by com.caucho.vfs.Encoding

public class Encoding
extends java.lang.Object

Converts between the mime encoding names and Java encoding names.


Method Summary
static java.lang.String getJavaName(java.util.Locale locale)
          Returns the Java name for the given locale.
static java.lang.String getJavaName(java.lang.String encoding)
          Returns the Java name for the given encoding.
static EncodingWriter getLatin1Writer()
          Returns the latin 1 writer.
static java.lang.String getMimeName(java.util.Locale locale)
          Returns the canonical mime name for the given locale.
static java.lang.String getMimeName(java.lang.String encoding)
          Returns the canonical mime name for the given character encoding.
static java.io.Reader getReadEncoding(java.io.InputStream is, java.lang.String encoding)
          Returns a Reader to translate bytes to characters.
static EncodingReader getReadFactory(java.lang.String encoding)
          Returns a Reader to translate bytes to characters.
static EncodingWriter getWriteEncoding(java.lang.String encoding)
          Returns an EncodingWriter to translate characters to bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMimeName

public static java.lang.String getMimeName(java.lang.String encoding)
Returns the canonical mime name for the given character encoding.

Parameters:
encoding - character encoding name, possibly an alias
Returns:
canonical mime name for the encoding.

getMimeName

public static java.lang.String getMimeName(java.util.Locale locale)
Returns the canonical mime name for the given locale.

Parameters:
locale - locale to use.
Returns:
canonical mime name for the encoding.

getReadEncoding

public static java.io.Reader getReadEncoding(java.io.InputStream is,
                                             java.lang.String encoding)
                                      throws java.io.UnsupportedEncodingException
Returns a Reader to translate bytes to characters. If a specialized reader exists in com.caucho.vfs.i18n, use it.

Parameters:
is - the input stream.
encoding - the encoding name.
Returns:
a reader for the translation
Throws:
java.io.UnsupportedEncodingException

getReadFactory

public static EncodingReader getReadFactory(java.lang.String encoding)
                                     throws java.io.UnsupportedEncodingException
Returns a Reader to translate bytes to characters. If a specialized reader exists in com.caucho.vfs.i18n, use it.

Parameters:
is - the input stream.
encoding - the encoding name.
Returns:
a reader for the translation
Throws:
java.io.UnsupportedEncodingException

getWriteEncoding

public static EncodingWriter getWriteEncoding(java.lang.String encoding)
Returns an EncodingWriter to translate characters to bytes.

Parameters:
encoding - the encoding name.
Returns:
a writer for the translation

getLatin1Writer

public static EncodingWriter getLatin1Writer()
Returns the latin 1 writer.


getJavaName

public static java.lang.String getJavaName(java.lang.String encoding)
Returns the Java name for the given encoding.

Parameters:
encoding - character encoding name
Returns:
Java encoding name

getJavaName

public static java.lang.String getJavaName(java.util.Locale locale)
Returns the Java name for the given locale.

Parameters:
locale - the locale to use
Returns:
Java encoding name