public final class JsonSourcePushParser extends Object implements JsonPushParser
JsonSourcePushParser is a stream based JSON parser. It reads
characters from a given Reader as far as necessary to calculate a
JsonState or to yield the next value.| Constructor and Description |
|---|
JsonSourcePushParser(char[] characters)
Creates a new
JsonSourcePushParser for the given char[]. |
JsonSourcePushParser(JsonSource source)
Creates a new
JsonSourcePushParser for the given
JsonSource. |
JsonSourcePushParser(Reader reader)
Creates a new
JsonSourcePushParser for the given Reader. |
JsonSourcePushParser(Reader reader,
int size)
Creates a new
JsonSourcePushParser for the given Reader. |
JsonSourcePushParser(String string)
Creates a new
JsonSourcePushParser for the given String. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
getColumn()
Returns the
column that corresponds to the
current position of the underlying JsonSource in the character
sequence, as if the character source was a regular file. |
int |
getLine()
Returns the
line that corresponds to the
current position of the underlying JsonSource in the character
sequence, as if the character source was a regular file. |
<Result> Result |
handle(JsonHandler<Result> handler)
Handle the character sequence from the
JsonSource and report to
the JsonHandler. |
<Result> Result |
handle(JsonHandler<Result> handler,
JsonParserMode... modes)
Handle the character sequence from the
JsonSource and report to
the JsonHandler. |
String |
toString() |
public JsonSourcePushParser(String string) throws IllegalArgumentException
JsonSourcePushParser for the given String.string - The String to read from.IllegalArgumentException - If the given String is null or if the
given JsonHandler is null.public JsonSourcePushParser(char[] characters)
throws IllegalArgumentException
JsonSourcePushParser for the given char[].characters - The char[] to read from.IllegalArgumentException - If the given String is null or if the
given JsonHandler is null.public JsonSourcePushParser(Reader reader) throws IllegalArgumentException
JsonSourcePushParser for the given Reader.reader - The Reader to read from.IllegalArgumentException - If the given String is null.public JsonSourcePushParser(Reader reader, int size) throws IllegalArgumentException
JsonSourcePushParser for the given Reader.reader - The Reader to read from.size - The buffer size to be used.IllegalArgumentException - If the given String is null or if the
given JsonHandler is null or if the given
size is smaller than the
minimum buffer
size.public JsonSourcePushParser(JsonSource source) throws IllegalArgumentException
JsonSourcePushParser for the given
JsonSource.source - The JsonSource to read from.IllegalArgumentException - If the given String is null or if the
given JsonHandler is null.public <Result> Result handle(JsonHandler<Result> handler) throws IllegalArgumentException, JsonSyntaxException, IOException
JsonPushParserJsonSource and report to
the JsonHandler.
Calling this method closes the underlying JsonSource, but it can
be closed manually.
handle in interface JsonPushParserResult - The result type of the JsonHandler.handler - The JsonHandler to report to.JsonHandler.IllegalArgumentException - If the given JsonHandler is null.JsonSyntaxException - If the JsonSyntaxException document contains a syntax
error.IOException - If reading from the underlying Reader failed.public <Result> Result handle(JsonHandler<Result> handler, JsonParserMode... modes) throws IllegalArgumentException, JsonSyntaxException, IOException
JsonSource and report to
the JsonHandler.
Calling this method closes the underlying JsonSource, but it can
be closed manually.
Result - The result type of the JsonHandler.handler - The JsonHandler to report to.modes - Selection of JsonParserModes to be used
during parsing.JsonHandler.IllegalArgumentException - If the given JsonHandler is null.JsonSyntaxException - If the JsonSyntaxException document contains a syntax
error.IOException - If reading from the underlying Reader failed.public int getLine()
JsonPushParserline that corresponds to the
current position of the underlying JsonSource in the character
sequence, as if the character source was a regular file.getLine in interface JsonPushParserpublic int getColumn()
JsonPushParsercolumn that corresponds to the
current position of the underlying JsonSource in the character
sequence, as if the character source was a regular file.getColumn in interface JsonPushParserpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2016 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.