public class ChunkIterator extends LookAheadIterator<byte[]> implements java.util.Iterator<byte[]>
Modifier and Type | Field and Description |
---|---|
private int |
chunksize |
private int |
recordsize |
private java.io.DataInputStream |
stream
create a ChunkIterator
a ChunkIterator uses a BufferedInputStream to iterate through the file
and is therefore a fast option to get all elements in the file as a sequence
ATTENTION: before calling this class ensure that all file buffers are flushed
ATTENTION: if the iterator is not read to the end or interrupted, close() must be called to release the InputStream
|
Constructor and Description |
---|
ChunkIterator(java.io.File file,
int recordsize,
int chunksize) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Special close methode to release the used InputStream
stream is automatically closed on last next(),
close() needs only be called if iterator not read to the end ( hasNext() or next() has not returned null)
|
byte[] |
next0()
the internal next-method
|
hasNext, iterator, next, remove
private final int chunksize
private final java.io.DataInputStream stream
private final int recordsize
public ChunkIterator(java.io.File file, int recordsize, int chunksize) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void close() throws java.io.IOException
java.io.IOException
public byte[] next0()
LookAheadIterator
next0
in class LookAheadIterator<byte[]>