Package com.ctc.wstx.io
Class BambooUTF8Reader
- java.lang.Object
-
- java.io.Reader
-
- com.ctc.wstx.io.BambooUTF8Reader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
public final class BambooUTF8Reader extends Reader
Optimized Reader that reads UTF-8 encoded content from an input stream. In addition to doing (hopefully) optimal conversion, it can also take array of "pre-read" (leftover) bytes; this is necessary when preliminary stream/reader is trying to figure out XML encoding.
-
-
Field Summary
Fields Modifier and Type Field Description protected static char
CONVERT_LSEP_TO
protected static char
CONVERT_NEL_TO
protected byte[]
mByteBuffer
protected int
mByteBufferEnd
protected int
mBytePtr
protected com.ctc.wstx.api.ReaderConfig
mConfig
protected static char
NULL_BYTE
protected static char
NULL_CHAR
-
Constructor Summary
Constructors Constructor Description BambooUTF8Reader(com.ctc.wstx.api.ReaderConfig cfg, InputStream in, byte[] buf, int ptr, int len, boolean recycleBuffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canModifyBuffer()
void
close()
void
freeBuffers()
protected InputStream
getStream()
int
read()
int
read(char[] cbuf, int start, int len)
protected int
readBytes()
protected int
readBytesAt(int arg0)
protected void
reportBounds(char[] arg0, int arg1, int arg2)
protected void
reportInvalidXml11(int arg0, int arg1, int arg2)
protected void
reportStrangeStream()
void
setXmlCompliancy(int xmlVersion)
-
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, ready, reset, skip, transferTo
-
-
-
-
Field Detail
-
NULL_CHAR
protected static final char NULL_CHAR
- See Also:
- Constant Field Values
-
NULL_BYTE
protected static final char NULL_BYTE
- See Also:
- Constant Field Values
-
CONVERT_NEL_TO
protected static final char CONVERT_NEL_TO
- See Also:
- Constant Field Values
-
CONVERT_LSEP_TO
protected static final char CONVERT_LSEP_TO
- See Also:
- Constant Field Values
-
mConfig
protected final com.ctc.wstx.api.ReaderConfig mConfig
-
mByteBuffer
protected byte[] mByteBuffer
-
mBytePtr
protected int mBytePtr
-
mByteBufferEnd
protected int mByteBufferEnd
-
-
Constructor Detail
-
BambooUTF8Reader
public BambooUTF8Reader(com.ctc.wstx.api.ReaderConfig cfg, InputStream in, byte[] buf, int ptr, int len, boolean recycleBuffer)
-
-
Method Detail
-
setXmlCompliancy
public void setXmlCompliancy(int xmlVersion)
-
read
public int read(char[] cbuf, int start, int len) throws IOException
- Specified by:
read
in classReader
- Throws:
IOException
-
canModifyBuffer
protected final boolean canModifyBuffer()
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-
read
public int read() throws IOException
- Overrides:
read
in classReader
- Throws:
IOException
-
getStream
protected final InputStream getStream()
-
readBytes
protected final int readBytes() throws IOException
- Throws:
IOException
-
readBytesAt
protected final int readBytesAt(int arg0) throws IOException
- Throws:
IOException
-
freeBuffers
public final void freeBuffers()
-
reportBounds
protected void reportBounds(char[] arg0, int arg1, int arg2) throws IOException
- Throws:
IOException
-
reportStrangeStream
protected void reportStrangeStream() throws IOException
- Throws:
IOException
-
reportInvalidXml11
protected void reportInvalidXml11(int arg0, int arg1, int arg2) throws IOException
- Throws:
IOException
-
-