Package nl.vpro.jackson2
Class JsonArrayIterator<T>
- java.lang.Object
-
- com.google.common.collect.UnmodifiableIterator<T>
-
- nl.vpro.jackson2.JsonArrayIterator<T>
-
- All Implemented Interfaces:
com.google.common.collect.PeekingIterator<T>,AutoCloseable,Iterator<T>,nl.vpro.util.CloseableIterator<T>,nl.vpro.util.CountedIterator<T>
public class JsonArrayIterator<T> extends com.google.common.collect.UnmodifiableIterator<T> implements nl.vpro.util.CloseableIterator<T>, com.google.common.collect.PeekingIterator<T>, nl.vpro.util.CountedIterator<T>- Since:
- 1.0
- Author:
- Michiel Meeuwissen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJsonArrayIterator.Builder<T>static classJsonArrayIterator.ValueReadException
-
Constructor Summary
Constructors Constructor Description JsonArrayIterator(InputStream inputStream, Class<T> clazz)JsonArrayIterator(InputStream inputStream, Class<T> clazz, Runnable callback)JsonArrayIterator(InputStream inputStream, BiFunction<com.fasterxml.jackson.core.JsonParser,com.fasterxml.jackson.core.TreeNode,T> valueCreator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidcallback()voidclose()voidfinalize()protected voidfindNext()LonggetCount()@NonNull Optional<Long>getSize()@NonNull Optional<Long>getTotalSize()booleanhasNext()Tnext()Tpeek()voidwrite(OutputStream out, Consumer<T> logging)Write the entire stream to an output streamvoidwrite(OutputStream out, Function<T,Void> logging)Deprecated.static <T> voidwrite(nl.vpro.util.CountedIterator<T> iterator, OutputStream out, Function<T,Void> logging)Write the entire stream to an output streamvoidwriteArray(OutputStream out, Consumer<T> logging)static <T> voidwriteArray(nl.vpro.util.CountedIterator<T> iterator, OutputStream out, Function<T,Void> logging)Write the entire stream to an output streamstatic <T> voidwriteObjects(nl.vpro.util.CountedIterator<T> iterator, com.fasterxml.jackson.core.JsonGenerator jg, Function<T,Void> logging)Write the entire stream as an array to jsonGenerator-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
JsonArrayIterator
public JsonArrayIterator(InputStream inputStream, Class<T> clazz) throws IOException
- Throws:
IOException
-
JsonArrayIterator
public JsonArrayIterator(InputStream inputStream, Class<T> clazz, Runnable callback) throws IOException
- Throws:
IOException
-
JsonArrayIterator
public JsonArrayIterator(InputStream inputStream, BiFunction<com.fasterxml.jackson.core.JsonParser,com.fasterxml.jackson.core.TreeNode,T> valueCreator) throws IOException
- Throws:
IOException
-
-
Method Detail
-
next
public T next()
-
findNext
protected void findNext()
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacenl.vpro.util.CountedIterator<T>- Throws:
IOException
-
callback
protected void callback()
-
write
public void write(OutputStream out, Consumer<T> logging) throws IOException
Write the entire stream to an output stream- Throws:
IOException
-
writeArray
public void writeArray(OutputStream out, Consumer<T> logging) throws IOException
- Throws:
IOException
-
write
public void write(OutputStream out, Function<T,Void> logging) throws IOException
Deprecated.Write the entire stream to an output stream- Throws:
IOException
-
write
public static <T> void write(nl.vpro.util.CountedIterator<T> iterator, OutputStream out, Function<T,Void> logging) throws IOExceptionWrite the entire stream to an output stream- Throws:
IOException
-
writeArray
public static <T> void writeArray(nl.vpro.util.CountedIterator<T> iterator, OutputStream out, Function<T,Void> logging) throws IOExceptionWrite the entire stream to an output stream- Throws:
IOException
-
writeObjects
public static <T> void writeObjects(nl.vpro.util.CountedIterator<T> iterator, com.fasterxml.jackson.core.JsonGenerator jg, Function<T,Void> logging) throws IOExceptionWrite the entire stream as an array to jsonGenerator- Throws:
IOException
-
getSize
public @NonNull Optional<Long> getSize()
- Specified by:
getSizein interfacenl.vpro.util.CountedIterator<T>
-
-