Package org.apache.maven.index.reader
Class ChunkReader
- java.lang.Object
-
- org.apache.maven.index.reader.ChunkReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<java.util.Map<java.lang.String,java.lang.String>>
public class ChunkReader extends java.lang.Object implements java.io.Closeable, java.lang.Iterable<java.util.Map<java.lang.String,java.lang.String>>
Maven 2 Index published binary chunk reader, it reads raw Maven Indexer records from the transport binary format.- Since:
- 5.1.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ChunkReader.IndexIterator
Low memory footprint index iterator that incrementally parses the underlying stream.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
chunkName
private java.io.DataInputStream
dataInputStream
private java.util.Date
timestamp
private int
version
-
Constructor Summary
Constructors Constructor Description ChunkReader(java.lang.String chunkName, java.io.InputStream inputStream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 theRecord
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, ornull
if no more records.private static java.lang.String
readUTF(java.io.DataInput dataInput)
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the chunk name.
-
getVersion
public int getVersion()
Returns index version. All releases so far always returned1
.
-
getTimestamp
public java.util.Date getTimestamp()
Returns the index timestamp of last update of the index.
-
iterator
public java.util.Iterator<java.util.Map<java.lang.String,java.lang.String>> iterator()
Returns theRecord
iterator.- Specified by:
iterator
in interfacejava.lang.Iterable<java.util.Map<java.lang.String,java.lang.String>>
-
close
public void close() throws java.io.IOException
Closes this reader and it's underlying input.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
readRecord
private static java.util.Map<java.lang.String,java.lang.String> readRecord(java.io.DataInput dataInput) throws java.io.IOException
Reads and returns next record from the underlying stream, ornull
if no more records.- Throws:
java.io.IOException
-
readField
private static void readField(java.util.Map<java.lang.String,java.lang.String> record, java.io.DataInput dataInput) throws java.io.IOException
- Throws:
java.io.IOException
-
readUTF
private static java.lang.String readUTF(java.io.DataInput dataInput) throws java.io.IOException
- Throws:
java.io.IOException
-
-