public final class FileIndex extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MAGIC
For serialization
|
| Modifier and Type | Method and Description |
|---|---|
long |
getLastRecordNumber()
Returns the last record number indexed by this index.
|
String |
getMetadata(String key)
Returns a metadata record.
|
long |
getNearestPosition(long recordNumber)
Returns the nearest (from the left side, i.e.
|
long |
getNearestRecordNumber(long recordNumber)
Returns the record number, which is nearest (from the left side, i.e.
|
long |
getStartingRecordNumber()
Returns the first record number indexed by this index.
|
long |
getStep()
Returns step of current index
|
static FileIndex |
read(File file)
Reads index from file.
|
static FileIndex |
read(InputStream stream)
Reads index from input stream.
|
static FileIndex |
read(String fileName)
Reads index from file.
|
void |
write(File file)
Writes this index to specified file.
|
void |
write(OutputStream stream)
Writes this index to specified output stream.
|
void |
write(String fileName)
Writes this index to specified file.
|
public static final int MAGIC
public long getStep()
public long getStartingRecordNumber()
public long getLastRecordNumber()
public String getMetadata(String key)
key - metadata keypublic long getNearestPosition(long recordNumber)
recordNumber - number of recordpublic long getNearestRecordNumber(long recordNumber)
recordNumber - number of recordpublic void write(String fileName) throws IOException
fileName - file nameIOExceptionpublic void write(File file) throws IOException
file - fileIOExceptionpublic void write(OutputStream stream) throws IOException
stream - output streamIOExceptionpublic static FileIndex read(String fileName) throws IOException
fileName - input file nameFileIndexIOExceptionpublic static FileIndex read(File file) throws IOException
file - input fileFileIndexIOExceptionpublic static FileIndex read(InputStream stream) throws IOException
stream - input streamFileIndexIOExceptionCopyright © 2018. All rights reserved.