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) |
read
private 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 segmentIOException
public void close() throws IOException
close
in class SubStoreReader
IOException
public long getFilePointer() throws IOException
getFilePointer
in class SubStoreReader
IOException
public long length() throws IOException
length
in class SubStoreReader
IOException
private void checkLength(int nBytes) throws IOException
nBytes
- Amount of space desiredIOException
public void read(byte[] b, int off, int len) throws IOException
read
in class SubStoreReader
IOException
public void seek(long pos) throws IOException
seek
in class SubStoreReader
IOException
public byte readByte() throws IOException
readByte
in class SubStoreReader
IOException
public int readInt() throws IOException
readInt
in class SubStoreReader
IOException