Class Utf32Reader
java.lang.Object
java.io.Reader
com.fasterxml.aalto.in.Utf32Reader
- All Implemented Interfaces:
Closeable, AutoCloseable, Readable
Since JDK does not come with UTF-32/UCS-4, let's implement a simple
decoder to use.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanprotected byte[]protected intTotal read byte count; used for error reporting purposesprotected intTotal read character count; used for error reporting purposesprotected final ReaderConfigprotected InputStreamprotected intprotected intprotected charAlthough 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. -
Constructor Summary
ConstructorsConstructorDescriptionUtf32Reader(ReaderConfig cfg, InputStream in, byte[] buf, int ptr, int len, boolean isBigEndian) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()final voidintread()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 caseintread(char[] cbuf, int start, int len) protected voidreportBounds(char[] cbuf, int start, int len) protected voidMethods inherited from class Reader
mark, markSupported, nullReader, of, read, read, readAllAsString, readAllLines, ready, reset, skip, transferTo
-
Field Details
-
mConfig
-
mIn
-
mBuffer
protected byte[] mBuffer -
mPtr
protected int mPtr -
mLength
protected int mLength -
mBigEndian
protected final boolean mBigEndian -
mSurrogate
protected char mSurrogateAlthough 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. -
mCharCount
protected int mCharCountTotal read character count; used for error reporting purposes -
mByteCount
protected int mByteCountTotal read byte count; used for error reporting purposes
-
-
Constructor Details
-
Utf32Reader
public Utf32Reader(ReaderConfig cfg, InputStream in, byte[] buf, int ptr, int len, boolean isBigEndian)
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-
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- Overrides:
readin classReader- Throws:
IOException
-
read
- Specified by:
readin classReader- Throws:
IOException
-
freeBuffers
public final void freeBuffers() -
reportBounds
- Throws:
IOException
-
reportStrangeStream
- Throws:
IOException
-