public interface BlockDeviceDriver
| Modifier and Type | Method and Description |
|---|---|
int |
getBlockSize()
Returns the block size of the block device.
|
void |
init()
Initializes the block device for further use.
|
void |
read(long deviceOffset,
java.nio.ByteBuffer buffer)
Reads from the block device at a certain offset into the given buffer.
|
void |
write(long deviceOffset,
java.nio.ByteBuffer buffer)
Writes to the block device at a certain offset from the given buffer.
|
void init() throws java.io.IOException
java.io.IOException - If initializing failsvoid read(long deviceOffset,
java.nio.ByteBuffer buffer)
throws java.io.IOException
Buffer.remaining().
The deviceOffset can either be the amount of bytes or a logical block
addressing using the block size. To get the bytes in the last case you
have to multiply the lba with the block size (offset *
getBlockSize()).
deviceOffset - The offset where the reading should begin.buffer - The buffer where the data should be read into.java.io.IOException - If reading fails.void write(long deviceOffset,
java.nio.ByteBuffer buffer)
throws java.io.IOException
Buffer.remaining().
The deviceOffset can either be the amount of bytes or a logical block
addressing using the block size. To get the bytes in the last case you
have to multiply the lba with the block size (offset *
getBlockSize()).
deviceOffset - The offset where the writing should begin.buffer - The buffer with the data to be transferred.java.io.IOException - If writing fails.int getBlockSize()
That means that it is only possible to read or write hole blocks!