|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectSubStoreReader
SubFileReader
class SubFileReader
Reads a single sub-file within a StructuredFile
. A sub-file
provides standard DataInput/DataOutput facilities, and takes care of
reading from the correct subset of the main StructuredFile.
Field Summary | |
---|---|
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 Summary | |
---|---|
SubFileReader(RandomAccessFile file,
StructuredFile parent,
long segOffset,
long segLength)
Construct a subfile reader. |
Method Summary | |
---|---|
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)
|
Methods inherited from class SubStoreReader |
---|
read |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private RandomAccessFile file
private StructuredFile parent
private long segOffset
private long segLength
private long curPos
Constructor Detail |
---|
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 segment
IOException
Method Detail |
---|
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 desired
IOException
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |