Class XmlHeaderAwareReader
java.lang.Object
java.io.Reader
com.thoughtworks.xstream.core.util.XmlHeaderAwareReader
- All Implemented Interfaces:
Closeable, AutoCloseable, Readable
A
Reader that evaluates the XML header. It selects its encoding based on the encoding read with the XML
header of the provided InputStream. The default encoding is UTF-8 and the version is 1.0 if the
stream does not contain an XML header or the attributes are not set within the header.- Since:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate final InputStreamReaderprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate final doubleprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanprivate MapgetHeader(PushbackInputStream[] in) doubleinthashCode()voidmark(int readAheadLimit) booleanintread()intread(char[] cbuf) intread(char[] cbuf, int offset, int length) booleanready()voidreset()longskip(long n) toString()Methods inherited from class Reader
nullReader, of, read, readAllAsString, readAllLines, transferTo
-
Field Details
-
reader
-
version
private final double version -
KEY_ENCODING
- See Also:
-
KEY_VERSION
- See Also:
-
XML_TOKEN
- See Also:
-
STATE_BOM
private static final int STATE_BOM- See Also:
-
STATE_START
private static final int STATE_START- See Also:
-
STATE_AWAIT_XML_HEADER
private static final int STATE_AWAIT_XML_HEADER- See Also:
-
STATE_ATTR_NAME
private static final int STATE_ATTR_NAME- See Also:
-
STATE_ATTR_VALUE
private static final int STATE_ATTR_VALUE- See Also:
-
-
Constructor Details
-
XmlHeaderAwareReader
Constructs an XmlHeaderAwareReader.- Parameters:
in- theInputStream- Throws:
UnsupportedEncodingException- if the encoding is not supportedIOException- occurred while reading the XML header- Since:
- 1.3
-
-
Method Details
-
getHeader
- Throws:
IOException
-
getEncoding
- Since:
- 1.3
- See Also:
-
getVersion
public double getVersion()- Since:
- 1.3
- See Also:
-
mark
- Overrides:
markin classReader- Throws:
IOException- See Also:
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classReader- See Also:
-
read
- Overrides:
readin classReader- Throws:
IOException- See Also:
-
read
- Specified by:
readin classReader- Throws:
IOException- See Also:
-
read
- Overrides:
readin classReader- Throws:
IOException- See Also:
-
ready
- Overrides:
readyin classReader- Throws:
IOException- See Also:
-
reset
- Overrides:
resetin classReader- Throws:
IOException- See Also:
-
skip
- Overrides:
skipin classReader- Throws:
IOException- See Also:
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException- See Also:
-
equals
-
hashCode
-
toString
-