Package no.digipost.io
Class InputStreamIterator
java.lang.Object
no.digipost.io.InputStreamIterator
- All Implemented Interfaces:
Iterator<byte[]>
InputStreamIterator is an
Iterator reading from an InputStream in chunks
where each chunk is returned as the next element in the iterable.
When the input stream is fully consumed the iterator has no more elements.-
Constructor Summary
ConstructorsConstructorDescriptionInputStreamIterator(InputStream inputStream, int chunkSizeBytes) InputStreamIterator(InputStream inputStream, DataSize chunkSize) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
InputStreamIterator
- Parameters:
inputStream- The input stream to iterate overchunkSize- DataSize should not be too big since that defeats the purpose of this iterator.
-
InputStreamIterator
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<byte[]>- Returns:
- true if the iteration has more elements
- Throws:
UncheckedIOException- if the wrapped InputStream throws an IOException
-
next
public byte[] next()
-