org.apache.xml.serializer
Class Encodings
Object
org.apache.xml.serializer.Encodings
public class Encodings
extends Object
Provides information about encodings. Depends on the Java runtime
to provides writers for the different encodings, but can be used
to override encoding names and provide the last printable character
for each encoding.
Version:
- Assaf Arkin
static String | convertJava2MimeEncoding(String encoding) - Try the best we can to convert a Java encoding to a XML-style encoding.
|
static String | convertMime2JavaEncoding(String encoding) - Try the best we can to convert a Java encoding to a XML-style encoding.
|
static Object | getCharToByteConverter(String encoding) - Returns an opaque CharToByte converter for the specified encoding.
|
static int | getLastPrintable() - Returns the last printable character for an unspecified
encoding.
|
static int | getLastPrintable(String encoding) - Returns the last printable character for the specified
encoding.
|
static String | getMimeEncoding(String encoding) - Get the proper mime encoding.
|
static Writer | getWriter(OutputStream output, String encoding) - Returns a writer for the specified encoding based on
an output stream.
|
DEFAULT_MIME_ENCODING
public static final String DEFAULT_MIME_ENCODING
The default encoding, ISO style, ISO style.
convertJava2MimeEncoding
public static String convertJava2MimeEncoding(String encoding)
Try the best we can to convert a Java encoding to a XML-style encoding.
encoding
- non-null reference to encoding string, java style.
- ISO-style encoding string.
convertMime2JavaEncoding
public static String convertMime2JavaEncoding(String encoding)
Try the best we can to convert a Java encoding to a XML-style encoding.
encoding
- non-null reference to encoding string, java style.
- ISO-style encoding string.
getCharToByteConverter
public static Object getCharToByteConverter(String encoding)
Returns an opaque CharToByte converter for the specified encoding.
encoding
- The encoding
- An object which should be a sun.io.CharToByteConverter, or null.
getLastPrintable
public static int getLastPrintable()
Returns the last printable character for an unspecified
encoding.
- the default size
getLastPrintable
public static int getLastPrintable(String encoding)
Returns the last printable character for the specified
encoding.
encoding
- The encoding
- The last printable character
getMimeEncoding
public static String getMimeEncoding(String encoding)
Get the proper mime encoding. From the XSLT recommendation: "The encoding
attribute specifies the preferred encoding to use for outputting the result
tree. XSLT processors are required to respect values of UTF-8 and UTF-16.
For other values, if the XSLT processor does not support the specified
encoding it may signal an error; if it does not signal an error it should
use UTF-8 or UTF-16 instead. The XSLT processor must not use an encoding
whose name does not match the EncName production of the XML Recommendation
[XML]. If no encoding attribute is specified, then the XSLT processor should
use either UTF-8 or UTF-16."
encoding
- Reference to java-style encoding string, which may be null,
in which case a default will be found.
- The ISO-style encoding string, or null if failure.
getWriter
public static Writer getWriter(OutputStream output,
String encoding)
throws UnsupportedEncodingException
Returns a writer for the specified encoding based on
an output stream.
output
- The output streamencoding
- The encoding
- A suitable writer
Copyright B) 2004 Apache XML Project. All Rights Reserved.