|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectSubStoreWriter
SubFileWriter
class SubFileWriter
Represents a single sub-file within a StructuredFile. A sub-file
provides standard DataInput/DataOutput facilities, and takes care of
writing to the correct subset of the main StructuredFile.
| Field Summary | |
|---|---|
private byte[] |
buf
Buffered data (cuts down access to the physical file) |
private static int |
BUF_SIZE
Size of the buffer to maintain |
private int |
bufTop
Amount of data buffered |
private RandomAccessFile |
file
Actual disk file to write to |
private StructuredFile |
parent
The structured file that owns this Subfile |
private long |
segOffset
Absolute file position for the subfile's start |
private long |
writtenPos
Current write position within the subfile |
| Constructor Summary | |
|---|---|
SubFileWriter(RandomAccessFile file,
StructuredFile parent,
long segOffset)
Construct a subfile writer. |
|
| Method Summary | |
|---|---|
private void |
checkLength(int nBytes)
Ensure that the buffer has room for the specified number of bytes. |
void |
close()
|
long |
length()
|
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
writeByte(int v)
|
void |
writeInt(int v)
|
| Methods inherited from class SubStoreWriter |
|---|
writeChars |
| 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 writtenPos
private static final int BUF_SIZE
private byte[] buf
private int bufTop
| Constructor Detail |
|---|
SubFileWriter(RandomAccessFile file,
StructuredFile parent,
long segOffset)
throws IOException
file - Disk file to attach toparent - Structured file to attach tosegOffset - Beginning offset of the segment
IOException| Method Detail |
|---|
public void close()
throws IOException
close in class SubStoreWriterIOException
public long length()
throws IOException
length in class SubStoreWriterIOException
private void checkLength(int nBytes)
throws IOException
nBytes - Amount of space desired
IOException
public void write(byte[] b)
throws IOException
write in class SubStoreWriterIOException
public void write(byte[] b,
int off,
int len)
throws IOException
write in class SubStoreWriterIOException
public void writeByte(int v)
throws IOException
writeByte in class SubStoreWriterIOException
public void writeInt(int v)
throws IOException
writeInt in class SubStoreWriterIOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||