|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface StructuredFile
Block oriented I/O operations.
| Method Summary | |
|---|---|
void |
addStructuredFileListener(StructuredFileListener listener)
Adds a StructuredFileListener to the listener list. |
void |
close()
Releases any system resources associated with an instance. |
void |
deleteBlocks(long index,
long count)
Removes blocks. |
long |
getBlockCount()
Reads the total amount of existing blocks. |
int |
getBlockSize()
Reads the length of one block in byte. |
StructuredFileListener[] |
getStructuredFileListeners()
Gets all currently registered StructuredFileListeners. |
void |
insertBlocks(long index,
long count)
Inserts new blocks. |
void |
readBlock(long block,
int off,
byte[] buf)
Reads buf.length byte starting at position off in
block. |
void |
readBlock(long block,
int off,
byte[] buf,
int index,
int length)
Reads length byte starting at position off in
block into buf starting at index inclusive. |
void |
removeStructuredFileListener(StructuredFileListener listener)
Removes a StructuredFileListener from the listener list. |
void |
writeBlock(long block,
int off,
byte[] buf)
Writes buf.length byte from buf into block
starting at off inclusive. |
void |
writeBlock(long block,
int off,
byte[] buf,
int index,
int length)
Writes length byte from buf starting at index
inclusive into block starting at off inclusive. |
| Method Detail |
|---|
void addStructuredFileListener(StructuredFileListener listener)
StructuredFileListener to the listener list.
listener - The listener to be added to the listener list.
NullPointerException - if listener is null.
void close()
throws IOException
IOException - if releasing system resources fails.
void deleteBlocks(long index,
long count)
throws IOException
index + count will be at index.
index - index of the first block to start removing count
blocks.count - number of blocks to remove.
IndexOutOfBoundsException - if index is negative or
count is negative or zero or index is greater than
getBlockCount() - count.
IOException - if deleting blocks fails.
long getBlockCount()
throws IOException
IOException - if getting the block count fails.
int getBlockSize()
throws IOException
IOException - if getting the block size fails.StructuredFileListener[] getStructuredFileListeners()
StructuredFileListeners.
StructuredFileListeners.
void insertBlocks(long index,
long count)
throws IOException
index will
be at index + count.
index - index of the first new block.count - number of blocks to insert starting at index.
IndexOutOfBoundsException - if index or count is
negativ or index is greater than getBlockCount() or
count is zero or greater than
Long.MAX_VALUE - getBlockCount().
IOException - if inserting blocks fails.
void readBlock(long block,
int off,
byte[] buf)
throws IOException
buf.length byte starting at position off in
block. Same as readBlock(block, off, buf, 0, buf.length).
block - index of the block to read data from.off - starting offset to the data to read from block.buf - array to store the data in.
NullPointerException - if buf is null.
IndexOutOfBoundsException - if block is negative,
greater than or equal to getBlockCount(), or off is
negative, greater than or equal to getBlockSize(), or the length
of buf is greater than getBlockSize() - off.
IOException - if reading fails.
void readBlock(long block,
int off,
byte[] buf,
int index,
int length)
throws IOException
length byte starting at position off in
block into buf starting at index inclusive.
block - index of the block to read data from.off - starting offset of the data to read from block.buf - array to store the data in.index - offset to start writing data into buf.length - number of byte to read.
NullPointerException - if buf is null.
IndexOutOfBoundsException - if block is negative,
greater than or equal to getBlockCount(), or off is
negative, greater than or equal to getBlockSize(), or
index is negative, greater than or equal to the length of
buf, or length is negative or greater than the
length of buf minus index or greater than
getBlockSize() - off.
IOException - if reading fails.void removeStructuredFileListener(StructuredFileListener listener)
StructuredFileListener from the listener list.
listener - The listener to be removed from the listener list.
NullPointerException - if listener is null.
void writeBlock(long block,
int off,
byte[] buf)
throws IOException
buf.length byte from buf into block
starting at off inclusive. Same as
writeBlock(block, off, buf, 0, buf.length).
block - index of the block to write into.off - inclusive offset to start writing into block.buf - data to write into block beginning at offset.
NullPointerException - if buf is null.
IndexOutOfBoundsException - if block is negative,
greater than or equal to getBlockCount(), or off is
greater than or equal to getBlockSize(), or the length of
buf is greater than getBlockSize() - off.
IOException - if writing fails.
void writeBlock(long block,
int off,
byte[] buf,
int index,
int length)
throws IOException
length byte from buf starting at index
inclusive into block starting at off inclusive.
block - index of the block to write into.off - inclusive offset to start writing into block.buf - data to write into block beginning at offset.index - inclusive offset to start reading data from buf.length - number of byte to read from buf starting at
index.
NullPointerException - if buf is null.
IndexOutOfBoundsException - if block is negative,
greater than or equal to getBlockCount(), or off is
negative, greater than or equal to getBlockSize(), or
index is negative, greater than or equal to the length of
buf, or length is negative or greater than the
length of buf minus index or greater than
getBlockSize() - off.
IOException - if writing fails.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||