public class FileSystemStorageUnit extends Object implements StorageUnit
Constructor and Description |
---|
FileSystemStorageUnit(OpenFileCache cache,
Path file) |
Modifier and Type | Method and Description |
---|---|
long |
capacity()
Get total maximum capacity of this storage.
|
void |
close() |
int |
readBlock(ByteBuffer buffer,
long offset)
Try to read a block of data into the provided buffer, starting with a given offset.
|
void |
readBlockFully(ByteBuffer buffer,
long offset) |
long |
size()
Get current amount of data in this storage.
|
String |
toString() |
int |
writeBlock(ByteBuffer buffer,
long offset)
Try to write a block of data from the provided buffer to this storage, starting with a given offset.
|
int |
writeBlock(ByteBufferView buffer,
long offset)
Try to write a block of data from the provided buffer to this storage, starting with a given offset.
|
void |
writeBlockFully(ByteBuffer buffer,
long offset) |
void |
writeBlockFully(ByteBufferView buffer,
long offset) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createEmpty, readBlock, writeBlock
public FileSystemStorageUnit(OpenFileCache cache, Path file)
public int readBlock(ByteBuffer buffer, long offset)
StorageUnit
Buffer.remaining()
.
Storage must throw an exception if
offset > StorageUnit.capacity()
- buffer.remaining()
readBlock
in interface StorageUnit
buffer
- Buffer to read bytes into.
Value returned by buffer.remaining() determines
the maximum number of bytes to read.offset
- Index to start reading from (0-based)public void readBlockFully(ByteBuffer buffer, long offset)
readBlockFully
in interface StorageUnit
public int writeBlock(ByteBuffer buffer, long offset)
StorageUnit
Maximum number of bytes to be written is determined by Buffer.remaining()
.
Storage must throw an exception if
offset > StorageUnit.capacity()
- buffer.remaining()
writeBlock
in interface StorageUnit
buffer
- Buffer containing the block of data to write to this storage.
Value returned by buffer.remaining() determines
the maximum number of bytes to write.offset
- Offset in this storage's data to start writing to (0-based)public void writeBlockFully(ByteBuffer buffer, long offset)
writeBlockFully
in interface StorageUnit
public int writeBlock(ByteBufferView buffer, long offset)
StorageUnit
Maximum number of bytes to be written is determined by ByteBufferView.remaining()
.
Storage must throw an exception if
offset > StorageUnit.capacity()
- buffer.remaining()
writeBlock
in interface StorageUnit
buffer
- Buffer containing the block of data to write to this storage.
Value returned by buffer.remaining() determines
the maximum number of bytes to write.offset
- Offset in this storage's data to start writing to (0-based)public void writeBlockFully(ByteBufferView buffer, long offset)
writeBlockFully
in interface StorageUnit
public long capacity()
StorageUnit
capacity
in interface StorageUnit
public long size()
StorageUnit
size
in interface StorageUnit
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2016–2021. All rights reserved.