public final class CharacterReader extends Object implements ICharacterInput
| Constructor and Description |
|---|
CharacterReader(InputStream stream)
Initializes a new instance of the
CharacterReader class; will read the stream as
UTF-8, skip the byte-order mark (U + FEFF) if it appears first in the
stream, and replace invalid byte sequences with replacement
characters (U + FFFD). |
CharacterReader(InputStream stream,
int mode)
Initializes a new instance of the
CharacterReader class; will skip the byte-order
mark (U + FEFF) if it appears first in the stream and replace invalid
byte sequences with replacement characters (U + FFFD). |
CharacterReader(InputStream stream,
int mode,
boolean errorThrow)
Initializes a new instance of the
CharacterReader class; will skip the byte-order
mark (U + FEFF) if it appears first in the stream. |
CharacterReader(InputStream stream,
int mode,
boolean errorThrow,
boolean dontSkipUtf8Bom)
Initializes a new instance of the
CharacterReader class. |
CharacterReader(String str)
Initializes a new instance of the
CharacterReader class using a Unicode 16-bit
string; if the string begins with a byte-order mark (U + FEFF), it
won't be skipped, and any unpaired surrogate code points (U+D800 to
U + DFFF) in the string are replaced with replacement characters
(U + FFFD). |
CharacterReader(String str,
boolean skipByteOrderMark)
Initializes a new instance of the
CharacterReader class using a Unicode 16-bit
string; any unpaired surrogate code points (U + D800 to U + DFFF) in the
string are replaced with replacement characters (U + FFFD). |
CharacterReader(String str,
boolean skipByteOrderMark,
boolean errorThrow)
Initializes a new instance of the
CharacterReader class using a Unicode 16-bit
string. |
CharacterReader(String str,
int offset,
int length)
Initializes a new instance of the
CharacterReader class. |
CharacterReader(String str,
int offset,
int length,
boolean skipByteOrderMark,
boolean errorThrow)
Initializes a new instance of the
CharacterReader class. |
| Modifier and Type | Method and Description |
|---|---|
int |
Read(int[] chars,
int index,
int length)
Reads a series of code points from a Unicode stream or a string.
|
int |
ReadChar()
Reads the next character from a Unicode stream or a string.
|
public CharacterReader(String str)
CharacterReader class using a Unicode 16-bit
string; if the string begins with a byte-order mark (U + FEFF), it
won't be skipped, and any unpaired surrogate code points (U+D800 to
U + DFFF) in the string are replaced with replacement characters
(U + FFFD).str - The string to read.NullPointerException - The parameter str is null.public CharacterReader(String str, boolean skipByteOrderMark)
CharacterReader class using a Unicode 16-bit
string; any unpaired surrogate code points (U + D800 to U + DFFF) in the
string are replaced with replacement characters (U + FFFD).str - The string to read.skipByteOrderMark - If true and the string begins with a byte-order
mark (U + FEFF), will skip that code point as it reads the string.NullPointerException - The parameter str is null.public CharacterReader(String str, boolean skipByteOrderMark, boolean errorThrow)
CharacterReader class using a Unicode 16-bit
string.str - The string to read.skipByteOrderMark - If true and the string begins with a byte-order
mark (U + FEFF), will skip that code point as it reads the string.errorThrow - If true, will throw an exception if unpaired surrogate
code points (U + D800 to U + DFFF) are found in the string. If false,
replaces those byte sequences with replacement characters (U + FFFD) as
the stream is read.NullPointerException - The parameter str is null.public CharacterReader(String str, int offset, int length)
CharacterReader class.str - The parameter str is a text string.offset - A zero-based index showing where the desired portion of str begins.length - The number of elements in the desired portion of str
(but not more than str 's length).public CharacterReader(String str, int offset, int length, boolean skipByteOrderMark, boolean errorThrow)
CharacterReader class.str - The parameter str is a text string.offset - A zero-based index showing where the desired portion of str begins.length - The number of elements in the desired portion of str
(but not more than str 's length).skipByteOrderMark - If true and the string begins with a byte-order
mark (U + FEFF), will skip that code point as it reads the string.errorThrow - If true, will throw an exception if unpaired surrogate
code points (U + D800 to U + DFFF) are found in the string. If false,
replaces those byte sequences with replacement characters (U + FFFD) as
the stream is read.NullPointerException - The parameter str is null.public CharacterReader(InputStream stream)
CharacterReader class; will read the stream as
UTF-8, skip the byte-order mark (U + FEFF) if it appears first in the
stream, and replace invalid byte sequences with replacement
characters (U + FFFD).stream - A readable data stream.NullPointerException - The parameter stream is null.public CharacterReader(InputStream stream, int mode, boolean errorThrow)
CharacterReader class; will skip the byte-order
mark (U + FEFF) if it appears first in the stream.stream - A readable byte stream.mode - The method to use when detecting encodings other than UTF-8 in
the byte stream. This usually involves checking whether the stream
begins with a byte-order mark (BOM, U + FEFF) or a non-zero basic code
point (NZB, U + 0001 to U + 007F) before reading the rest of the stream.
This value can be one of the following: errorThrow - If true, will throw an exception if invalid byte sequences
(in the detected encoding) are found in the byte stream. If false,
replaces those byte sequences with replacement characters (U + FFFD) as
the stream is read.NullPointerException - The parameter stream is null.public CharacterReader(InputStream stream, int mode)
CharacterReader class; will skip the byte-order
mark (U + FEFF) if it appears first in the stream and replace invalid
byte sequences with replacement characters (U + FFFD).stream - A readable byte stream.mode - The method to use when detecting encodings other than UTF-8 in
the byte stream. This usually involves checking whether the stream
begins with a byte-order mark (BOM, U + FEFF) or a non-zero basic code
point (NZB, U + 0001 to U + 007F) before reading the rest of the stream.
This value can be one of the following: NullPointerException - The parameter stream is null.public CharacterReader(InputStream stream, int mode, boolean errorThrow, boolean dontSkipUtf8Bom)
CharacterReader class.stream - A readable byte stream.mode - The method to use when detecting encodings other than UTF-8 in
the byte stream. This usually involves checking whether the stream
begins with a byte-order mark (BOM, U + FEFF) or a non-zero basic code
point (NZB, U + 0001 to U + 007F) before reading the rest of the stream.
This value can be one of the following: errorThrow - If true, will throw an exception if invalid byte sequences
(in the detected encoding) are found in the byte stream. If false,
replaces those byte sequences with replacement characters (U + FFFD) as
the stream is read.dontSkipUtf8Bom - If the stream is detected as UTF-8 and this parameter
is true, won't skip the BOM character if it occurs at the
start of the stream.NullPointerException - The parameter stream is null.public int Read(int[] chars,
int index,
int length)
Read in interface ICharacterInputchars - An array where the code points that were read will be stored.index - A zero-based index showing where the desired portion of chars begins.length - The number of elements in the desired portion of chars
(but not more than chars 's length).length parameter if the end of the stream is
reached.NullPointerException - The parameter chars is null.IllegalArgumentException - Either index or length is
less than 0 or greater than chars 's length, or chars
's length minus index is less than length.public int ReadChar()
ReadChar in interface ICharacterInputEncoding for Java documentation, generated in 2017.