public abstract class JsonSplitter extends Object implements Iterable<Payload>, Closeable
findNextNodeStart()
).
While iterating the caller must properly consume the Payload
instances before the next iteration. Failure
to do so will result in the iterator returning the same Payload
again.
The implementations of this class should be careful about handling the JsonParser
, especially if it uses a
different JsonGenerator
, since the method JsonGenerator.copyCurrentStructure(JsonParser)
is called by
the payload implementation that this class uses.
This class must be closed in order to free underlying resources.
Modifier | Constructor and Description |
---|---|
protected |
JsonSplitter(InputStream inputStream) |
protected |
JsonSplitter(InputStream inputStream,
PayloadMetadata metadata) |
protected |
JsonSplitter(JsonParser parser) |
protected |
JsonSplitter(JsonParser parser,
PayloadMetadata metadata) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected JsonGenerator |
createGenerator(OutputStream out) |
protected abstract JsonToken |
findNextNodeStart() |
protected JsonParser |
getParser() |
protected void |
initialize() |
Iterator<Payload> |
iterator() |
protected JsonToken |
waitForToken(JsonToken expectedToken) |
protected JsonToken |
waitForTokens(Set<JsonToken> tokenSet) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected JsonSplitter(InputStream inputStream) throws IOException
IOException
protected JsonSplitter(InputStream inputStream, PayloadMetadata metadata) throws IOException
IOException
protected JsonSplitter(JsonParser parser)
protected JsonSplitter(JsonParser parser, PayloadMetadata metadata)
protected final JsonParser getParser()
protected final JsonToken waitForToken(JsonToken expectedToken) throws IOException
IOException
protected final JsonToken waitForTokens(Set<JsonToken> tokenSet) throws IOException
IOException
protected JsonGenerator createGenerator(OutputStream out) throws IOException
IOException
protected void initialize() throws IOException
IOException
protected abstract JsonToken findNextNodeStart() throws IOException
IOException
public void close()
close
in interface Closeable
close
in interface AutoCloseable