public final class UTF8Reader extends Reader
Modifier and Type | Field and Description |
---|---|
protected byte[][] |
_bufferHolder |
protected static ThreadLocal<SoftReference<byte[][]>> |
_bufferRecycler
This
ThreadLocal contains a SoftReference
to a byte array used for holding content to decode |
protected byte[] |
_inputBuffer |
protected int |
_inputEnd
Pointed to the end marker, that is, position one after the last
valid available byte.
|
protected int |
_inputPtr
Pointer to the next available byte (if any), iff less than
mByteBufferEnd |
protected int |
_surrogate
Decoded first character of a surrogate pair, if one needs to be buffered
|
Constructor and Description |
---|
UTF8Reader(byte[] buf,
int ptr,
int len,
boolean autoClose) |
UTF8Reader(InputStream in,
boolean autoClose) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
freeBuffers()
This method should be called along with (or instead of) normal
close.
|
protected InputStream |
getStream() |
int |
read()
Although this method is implemented by the base class, AND it should
never be called by Woodstox code, let's still implement it bit more
efficiently just in case
|
int |
read(char[] cbuf) |
int |
read(char[] cbuf,
int start,
int len) |
protected int |
readBytes()
Method for reading as many bytes from the underlying stream as possible
(that fit in the buffer), to the beginning of the buffer.
|
protected int |
readBytesAt(int offset)
Method for reading as many bytes from the underlying stream as possible
(that fit in the buffer considering offset), to the specified offset.
|
protected void |
reportBounds(char[] cbuf,
int start,
int len) |
protected void |
reportStrangeStream() |
protected static final ThreadLocal<SoftReference<byte[][]>> _bufferRecycler
ThreadLocal
contains a SoftReference
to a byte array used for holding content to decodeprotected final byte[][] _bufferHolder
protected byte[] _inputBuffer
protected int _inputPtr
mByteBufferEnd
protected int _inputEnd
protected int _surrogate
public UTF8Reader(InputStream in, boolean autoClose)
public UTF8Reader(byte[] buf, int ptr, int len, boolean autoClose)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Reader
IOException
public int read() throws IOException
read
in class Reader
IOException
public int read(char[] cbuf) throws IOException
read
in class Reader
IOException
public int read(char[] cbuf, int start, int len) throws IOException
read
in class Reader
IOException
protected final InputStream getStream()
protected final int readBytes() throws IOException
IOException
protected final int readBytesAt(int offset) throws IOException
IOException
public final void freeBuffers()
protected void reportBounds(char[] cbuf, int start, int len) throws IOException
IOException
protected void reportStrangeStream() throws IOException
IOException
Copyright © 2020 FasterXML. All rights reserved.