|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Reader
com.fasterxml.jackson.core.io.UTF32Reader
public class UTF32Reader
Since JDK does not come with UTF-32/UCS-4, let's implement a simple decoder to use.
| Field Summary | |
|---|---|
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 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
|
| Fields inherited from class java.io.Reader |
|---|
lock |
| Constructor Summary | |
|---|---|
UTF32Reader(IOContext ctxt,
InputStream in,
byte[] buf,
int ptr,
int len,
boolean isBigEndian)
|
|
| Method Summary | |
|---|---|
void |
close()
|
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)
|
| Methods inherited from class java.io.Reader |
|---|
mark, markSupported, read, read, ready, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int LAST_VALID_UNICODE_CHAR
protected static final char NC
protected final IOContext _context
protected 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
| Constructor Detail |
|---|
public UTF32Reader(IOContext ctxt,
InputStream in,
byte[] buf,
int ptr,
int len,
boolean isBigEndian)
| Method Detail |
|---|
public void close()
throws IOException
close in interface Closeableclose in class ReaderIOException
public int read()
throws IOException
read in class ReaderIOException
public int read(char[] cbuf,
int start,
int len)
throws IOException
read in class ReaderIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||