public class UnicodeReader extends Object
This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
Modifier and Type | Field and Description |
---|---|
protected int |
bp |
protected char[] |
buf
The input buffer, index of next character to be read,
index of one past last character in buffer.
|
protected int |
buflen |
protected char |
ch
The current character.
|
protected Log |
log |
protected Names |
names |
protected char[] |
sbuf
A character buffer for saved chars.
|
protected int |
sp |
protected int |
unicodeConversionBp
The buffer index of the last converted unicode character
|
Modifier | Constructor and Description |
---|---|
protected |
UnicodeReader(ScannerFactory sf,
char[] input,
int inputLength) |
protected |
UnicodeReader(ScannerFactory sf,
CharBuffer buffer)
Create a scanner from the input array.
|
Modifier and Type | Method and Description |
---|---|
protected void |
convertUnicode()
Convert unicode escape; bp points to initial '\' character
(Spec 3.3).
|
protected int |
digit(int pos,
int base)
Convert an ASCII digit from its base (8, 10, or 16)
to its value.
|
char[] |
getRawCharacters()
Returns a copy of the input buffer, up to its inputLength.
|
char[] |
getRawCharacters(int beginIndex,
int endIndex)
Returns a copy of a character array subset of the input buffer.
|
protected boolean |
isUnicode() |
protected char |
peekChar() |
protected void |
putChar(boolean scan) |
protected void |
putChar(char ch) |
protected void |
putChar(char ch,
boolean scan)
Append a character to sbuf.
|
protected void |
scanChar()
Read next character.
|
protected void |
scanCommentChar()
Read next character in comment, skipping over double '\' characters.
|
protected char |
scanSurrogates()
Scan surrogate pairs.
|
protected void |
skipChar() |
protected char[] buf
protected int bp
protected final int buflen
protected char ch
protected int unicodeConversionBp
protected Log log
protected Names names
protected char[] sbuf
protected int sp
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer)
inputLength < input.length
or
input[input.length -1]
is a white space character.sf
- the factory which created this Scannerbuffer
- the input, might be modified
Must be positive and less than or equal to input.length.protected UnicodeReader(ScannerFactory sf, char[] input, int inputLength)
protected void scanChar()
protected void scanCommentChar()
protected void putChar(char ch, boolean scan)
protected void putChar(char ch)
protected void putChar(boolean scan)
protected void convertUnicode()
protected char scanSurrogates()
protected int digit(int pos, int base)
protected boolean isUnicode()
protected void skipChar()
protected char peekChar()
public char[] getRawCharacters()
public char[] getRawCharacters(int beginIndex, int endIndex)
beginIndex
and
extends to the character at index endIndex - 1
.
Thus the length of the substring is endIndex-beginIndex
.
This behavior is like
String.substring(beginIndex, endIndex)
.
Unicode escape sequences are not translated.beginIndex
- the beginning index, inclusive.endIndex
- the ending index, exclusive.ArrayIndexOutOfBoundsException
- if either offset is outside of the
array boundsCopyright © 2017 earcam. All rights reserved.