public final class

UTF32Reader

extends Reader
java.lang.Object
   ↳ java.io.Reader
     ↳ com.fasterxml.jackson.core.io.UTF32Reader

Class Overview

Since JDK does not come with UTF-32/UCS-4, let's implement a simple decoder to use.

Summary

Constants
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)
char NULL_BYTE
char NULL_CHAR
Fields
protected byte[] _buffer
protected final IOContext _context
protected InputStream _in
protected int _length
protected int _ptr
protected char[] _tmpBuf
[Expand]
Inherited Fields
From class java.io.Reader
Public Constructors
UTF32Reader(IOContext ctxt, InputStream in, byte[] buf, int ptr, int len, boolean isBigEndian)
Public Methods
void close()
final void freeBuffers()
This method should be called along with (or instead of) normal 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)
Protected Methods
void reportBounds(char[] cbuf, int start, int len)
void reportStrangeStream()
[Expand]
Inherited Methods
From class java.io.Reader
From class java.lang.Object
From interface java.io.Closeable
From interface java.lang.AutoCloseable
From interface java.lang.Readable

Constants

protected static final 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)

Constant Value: 1114111 (0x0010ffff)

protected static final char NULL_BYTE

Constant Value: 0 (0x00000000)

protected static final char NULL_CHAR

Constant Value: 0 (0x00000000)

Fields

protected byte[] _buffer

protected final IOContext _context

protected InputStream _in

protected int _length

protected int _ptr

protected char[] _tmpBuf

Public Constructors

public UTF32Reader (IOContext ctxt, InputStream in, byte[] buf, int ptr, int len, boolean isBigEndian)

Public Methods

public void close ()

Throws
IOException

public final void freeBuffers ()

This method should be called along with (or instead of) normal close. After calling this method, no further reads should be tried. Method will try to recycle read buffers (if any).

public 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

Throws
IOException

public int read (char[] cbuf, int start, int len)

Throws
IOException

Protected Methods

protected void reportBounds (char[] cbuf, int start, int len)

Throws
IOException

protected void reportStrangeStream ()

Throws
IOException