public class ChunkReader
extends java.lang.Object
implements java.io.Closeable, java.lang.Iterable<java.util.Map<java.lang.String,java.lang.String>>
| Modifier and Type | Class and Description |
|---|---|
private static class |
ChunkReader.IndexIterator
Low memory footprint index iterator that incrementally parses the underlying stream.
|
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
chunkName |
private java.io.DataInputStream |
dataInputStream |
private java.util.Date |
timestamp |
private int |
version |
| Constructor and Description |
|---|
ChunkReader(java.lang.String chunkName,
java.io.InputStream inputStream) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this reader and it's underlying input.
|
java.lang.String |
getName()
Returns the chunk name.
|
java.util.Date |
getTimestamp()
Returns the index timestamp of last update of the index.
|
int |
getVersion()
Returns index version.
|
java.util.Iterator<java.util.Map<java.lang.String,java.lang.String>> |
iterator()
Returns the
Record iterator. |
private static void |
readField(java.util.Map<java.lang.String,java.lang.String> record,
java.io.DataInput dataInput) |
private static java.util.Map<java.lang.String,java.lang.String> |
readRecord(java.io.DataInput dataInput)
Reads and returns next record from the underlying stream, or
null if no more records. |
private static java.lang.String |
readUTF(java.io.DataInput dataInput) |
private final java.lang.String chunkName
private final java.io.DataInputStream dataInputStream
private final int version
private final java.util.Date timestamp
public ChunkReader(java.lang.String chunkName,
java.io.InputStream inputStream)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getName()
public int getVersion()
1.public java.util.Date getTimestamp()
public java.util.Iterator<java.util.Map<java.lang.String,java.lang.String>> iterator()
Record iterator.iterator in interface java.lang.Iterable<java.util.Map<java.lang.String,java.lang.String>>public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionprivate static java.util.Map<java.lang.String,java.lang.String> readRecord(java.io.DataInput dataInput)
throws java.io.IOException
null if no more records.java.io.IOExceptionprivate static void readField(java.util.Map<java.lang.String,java.lang.String> record,
java.io.DataInput dataInput)
throws java.io.IOException
java.io.IOExceptionprivate static java.lang.String readUTF(java.io.DataInput dataInput)
throws java.io.IOException
java.io.IOException