class SubFileReader extends SubStoreReader
StructuredFile. A sub-file
provides standard DataInput/DataOutput facilities, and takes care of
reading from the correct subset of the main StructuredFile.| Modifier and Type | Field and Description |
|---|---|
private long |
curPos
Current read position within the subfile
|
private RandomAccessFile |
file
Actual disk file to write to
|
private StructuredFile |
parent
The structured file that owns this Subfile
|
private long |
segLength
Length of this subfile
|
private long |
segOffset
Absolute file position for the subfile's start
|
| Constructor and Description |
|---|
SubFileReader(RandomAccessFile file,
StructuredFile parent,
long segOffset,
long segLength)
Construct a subfile reader.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
checkLength(int nBytes)
Ensure that the sub-file has room to read the specified number of
bytes.
|
void |
close() |
long |
getFilePointer() |
long |
length() |
void |
read(byte[] b,
int off,
int len) |
byte |
readByte() |
int |
readInt() |
void |
seek(long pos) |
readprivate RandomAccessFile file
private StructuredFile parent
private long segOffset
private long segLength
private long curPos
SubFileReader(RandomAccessFile file,
StructuredFile parent,
long segOffset,
long segLength)
throws IOException
file - Disk file to attach toparent - Structured file to attach tosegOffset - Beginning offset of the segmentsegLength - Length of the segmentIOExceptionpublic void close()
throws IOException
close in class SubStoreReaderIOExceptionpublic long getFilePointer()
throws IOException
getFilePointer in class SubStoreReaderIOExceptionpublic long length()
throws IOException
length in class SubStoreReaderIOExceptionprivate void checkLength(int nBytes)
throws IOException
nBytes - Amount of space desiredIOExceptionpublic void read(byte[] b,
int off,
int len)
throws IOException
read in class SubStoreReaderIOExceptionpublic void seek(long pos)
throws IOException
seek in class SubStoreReaderIOExceptionpublic byte readByte()
throws IOException
readByte in class SubStoreReaderIOExceptionpublic int readInt()
throws IOException
readInt in class SubStoreReaderIOException