public class UTF32Reader
extends java.io.Reader
Modifier and Type | Field and Description |
---|---|
protected boolean |
_bigEndian |
protected byte[] |
_buffer |
protected int |
_byteCount
Total read byte count; used for error reporting purposes
|
protected int |
_charCount
Total read character count; used for error reporting purposes
|
protected IOContext |
_context |
protected java.io.InputStream |
_in |
protected int |
_length |
protected boolean |
_managedBuffers |
protected int |
_ptr |
protected char |
_surrogate
Although input is fine with full Unicode set, Java still uses
16-bit chars, so we may have to split high-order chars into
surrogate pairs.
|
protected char[] |
_tmpBuf |
protected static int |
LAST_VALID_UNICODE_CHAR
JSON actually limits available Unicode range in the high end
to the same as xml (to basically limit UTF-8 max byte sequence
length to 4)
|
protected static char |
NC |
Constructor and Description |
---|
UTF32Reader(IOContext ctxt,
java.io.InputStream in,
byte[] buf,
int ptr,
int len,
boolean isBigEndian) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
private void |
freeBuffers()
This method should be called along with (or instead of) normal
close.
|
private boolean |
loadMore(int available) |
int |
read()
Although this method is implemented by the base class, AND it should
never be called by main code, let's still implement it bit more
efficiently just in case
|
int |
read(char[] cbuf,
int start,
int len) |
private void |
reportBounds(char[] cbuf,
int start,
int len) |
private void |
reportInvalid(int value,
int offset,
java.lang.String msg) |
private void |
reportStrangeStream() |
private void |
reportUnexpectedEOF(int gotBytes,
int needed) |
protected static final int LAST_VALID_UNICODE_CHAR
protected static final char NC
protected final IOContext _context
protected java.io.InputStream _in
protected byte[] _buffer
protected int _ptr
protected int _length
protected final boolean _bigEndian
protected char _surrogate
protected int _charCount
protected int _byteCount
protected final boolean _managedBuffers
protected char[] _tmpBuf
public UTF32Reader(IOContext ctxt, java.io.InputStream in, byte[] buf, int ptr, int len, boolean isBigEndian)
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Reader
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
public int read(char[] cbuf, int start, int len) throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
private void reportUnexpectedEOF(int gotBytes, int needed) throws java.io.IOException
java.io.IOException
private void reportInvalid(int value, int offset, java.lang.String msg) throws java.io.IOException
java.io.IOException
private boolean loadMore(int available) throws java.io.IOException
available
- Number of "unused" bytes in the input bufferjava.io.IOException
private void freeBuffers()
private void reportBounds(char[] cbuf, int start, int len) throws java.io.IOException
java.io.IOException
private void reportStrangeStream() throws java.io.IOException
java.io.IOException