Class XMLInputStreamReader
java.lang.Object
java.io.Reader
de.pdark.decentxml.XMLInputStreamReader
- All Implemented Interfaces:
Closeable, AutoCloseable, Readable
Determine the encoding of a stream of bytes according to the
XML spec and return a Reader which converts the byte stream
into Unicode as it is read.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Readerstatic final StringThe constant "ISO-8859-1", also called "Latin-1"static final StringAn alias for ENCODING_ISO_8859_1A map to convert standard XML encodings into Java encodings.static final StringThe constant "UTF-8"private InputStreamA map to convert standard Java encodings into XML encodings.private Stringstatic final Patternprivate String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidDetermine the encoding of the stream.Get the Java name of the XML encoding of the stream.Return the encoding of the streamintread(char[] cbuf, int off, int len) voidsetXmlEncoding(String xmlEncoding) If you know the encoding, you can override it here.Methods inherited from class Reader
mark, markSupported, nullReader, of, read, read, read, readAllAsString, readAllLines, ready, reset, skip, transferTo
-
Field Details
-
ENCODING_UTF_8
-
ENCODING_ISO_8859_1
The constant "ISO-8859-1", also called "Latin-1"- See Also:
-
ENCODING_ISO_Latin_1
-
ENCODING_MAP
-
JAVA_TO_XML_ENCODING_MAP
-
in
-
xmlEncoding
-
javaEncoding
-
delegate
-
VERSION_PATTERN
-
-
Constructor Details
-
XMLInputStreamReader
-
-
Method Details
-
determineEncoding
public void determineEncoding()Determine the encoding of the stream.It is safe to call this method more than once from a single thread.
-
getXmlEncoding
Return the encoding of the stream -
setXmlEncoding
If you know the encoding, you can override it here.When you do that, the reader will ignore the encoding in the stream if there is one.
-
getJavaEncoding
Get the Java name of the XML encoding of the stream. -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-
read
- Specified by:
readin classReader- Throws:
IOException
-