public class BinDecorator extends java.lang.Object implements Bin
StorageDecorator.decorate(BinConfiguration, Bin).| Constructor and Description |
|---|
BinDecorator(Bin bin)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
closes the BinDecorator and the underlying
Bin. |
long |
length()
returns the length of the Bin (on disc, in memory).
|
int |
read(long position,
byte[] bytes,
int bytesToRead)
reads a given number of bytes into an array of bytes at an
offset position.
|
void |
sync()
flushes the buffer content to the physical storage
media.
|
void |
sync(java.lang.Runnable runnable)
runs the Runnable between two calls to sync();
|
int |
syncRead(long position,
byte[] bytes,
int bytesToRead)
reads a given number of bytes into an array of bytes at an
offset position.
|
void |
write(long position,
byte[] bytes,
int bytesToWrite)
writes a given number of bytes from an array of bytes at
an offset position
|
protected final Bin _bin
public void close()
Bin.public long length()
Binlength in interface BinBin.length()public int read(long position,
byte[] bytes,
int bytesToRead)
Binread in interface Binposition - the offset position to read atbytes - the byte array to read bytes intobytesToRead - the number of bytes to be readBin.read(long, byte[], int)public void sync()
Binsync in interface BinBin.sync()public int syncRead(long position,
byte[] bytes,
int bytesToRead)
BinBin.read(long, byte[], int)
method, the Bin should ensure direct access to the raw storage medium.
No caching should take place.syncRead in interface Binposition - the offset position to read atbytes - the byte array to read bytes intobytesToRead - the number of bytes to be readBin.syncRead(long, byte[], int)public void write(long position,
byte[] bytes,
int bytesToWrite)
Binwrite in interface Binposition - the offset position to write atbytes - the array of bytes to writebytesToWrite - the number of bytes to writeBin.write(long, byte[], int)