public class Tokenizer extends InputStream
| Modifier and Type | Class and Description |
|---|---|
static interface |
Tokenizer.TokenValidator |
| Modifier and Type | Field and Description |
|---|---|
protected int |
lineNo |
protected int |
linePos |
protected int |
readOffset |
| Constructor and Description |
|---|
Tokenizer(InputStream in,
boolean enclosedContent) |
| Modifier and Type | Method and Description |
|---|---|
Token |
expect(String expected)
Expect at a valid token containing anything.
|
Token |
expect(String expected,
Tokenizer.TokenValidator validator) |
Token |
expectIdentifier(String message) |
Token |
expectInteger(String message) |
Token |
expectLiteral(String message) |
char |
expectSymbol(String expected,
char... symbols) |
protected TokenizerException |
failure(int startLineNo,
int startLinePos,
int length,
String format,
Object... params) |
protected TokenizerException |
failure(String format,
Object... params) |
protected TokenizerException |
failure(Throwable cause,
int startLineNo,
int startLinePos,
int length,
String message,
Object... params) |
TokenizerException |
failure(Token token,
String message,
Object... params) |
String |
getLine(int theLine)
Get the full non-delimited line content of the 1-indexed line.
|
boolean |
hasNext() |
Token |
next() |
protected Token |
nextSymbol(int lastByte) |
Token |
peek() |
Token |
peek(String expected) |
int |
read() |
String |
readBinary(char end)
Read the 'content' of encoded binary.
|
protected Token |
token(int off,
int len,
int linePos) |
Token |
token(int off,
int len,
int lineNo,
int linePos) |
available, close, mark, markSupported, read, read, reset, skipprotected int readOffset
protected int lineNo
protected int linePos
public Tokenizer(InputStream in, boolean enclosedContent) throws IOException
IOExceptionpublic int read()
read in class InputStreampublic Token expect(@Nonnull String expected) throws IOException
expected - The expectation description.IOException - If failed to read a token.public Token expect(@Nonnull String expected, @Nonnull Tokenizer.TokenValidator validator) throws IOException
IOExceptionpublic Token peek(@Nonnull String expected) throws IOException
IOExceptionpublic Token peek() throws IOException
IOExceptionpublic char expectSymbol(@Nonnull String expected, char... symbols) throws IOException
IOExceptionpublic Token expectIdentifier(@Nonnull String message) throws IOException
IOException@Nonnull public Token expectInteger(String message) throws IOException
IOException@Nonnull public Token expectLiteral(String message) throws IOException
IOExceptionpublic boolean hasNext()
throws IOException
IOExceptionpublic Token next() throws IOException
IOExceptionprotected Token nextSymbol(int lastByte) throws TokenizerException
TokenizerException@Nonnull public String getLine(int theLine)
theLine - The nine number.public String readBinary(char end) throws IOException
end - The char that ends the binary content.TokenizerException - On illegal content.IOException@Nonnull public TokenizerException failure(Token token, String message, Object... params)
@Nonnull protected TokenizerException failure(int startLineNo, int startLinePos, int length, String format, Object... params)
@Nonnull protected TokenizerException failure(Throwable cause, int startLineNo, int startLinePos, int length, String message, Object... params)
@Nonnull protected TokenizerException failure(String format, Object... params)
Copyright © 2015–2017 morimekta.net. All rights reserved.