|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectxml.XMLBytesDecoder
public class XMLBytesDecoder
Supports the decoding of a given byte array, assumed to contain encoded XML, to give an XML String, taking account of some common UCS encodings. Specifically, attempts are made to recognize UTF-16, with or without a Byte-Order-Mark [BOM], UTF-8 with a BOM, and, failing any of these, taking account of an explicit encoding spec. in an XML declaration.
Before 2007-02 this class was called XMLBytesConverter
.
Constructor Summary | |
---|---|
XMLBytesDecoder(byte[] inb)
Constructs a decoder for the given byte array, using the standard XML default encoding (UTF-8). |
|
XMLBytesDecoder(byte[] inb,
java.lang.String dfltenc)
Constructs a decoder for the given byte array, using the given default encoding. |
Method Summary | |
---|---|
static java.lang.String |
explicitEncoding(java.lang.String xml)
If the given text starts with an XML declaration and that declaration explicitly specifies an encoding, then returns that encoding; otherwise returns null . |
java.lang.String |
explicitXMLEncoding()
If this decoder's text starts with an XML declaration and that declaration explicitly specifies an encoding, then returns that encoding; otherwise returns null . |
java.lang.String |
getXMLString()
Returns the decoded XML string. |
static void |
main(java.lang.String[] args)
Test method: attempts to convert the data in the file whose path is given by the sole argument, and lists the result on standard output. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLBytesDecoder(byte[] inb) throws java.io.IOException
java.io.IOException
public XMLBytesDecoder(byte[] inb, java.lang.String dfltenc) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
public java.lang.String getXMLString()
public java.lang.String explicitXMLEncoding()
null
.
public static java.lang.String explicitEncoding(java.lang.String xml)
null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |