Package com.db4o.io
Class SynchronizedBin
- java.lang.Object
-
- com.db4o.io.BinDecorator
-
- com.db4o.io.SynchronizedBin
-
- All Implemented Interfaces:
Bin
public class SynchronizedBin extends BinDecorator
-
-
Field Summary
-
Fields inherited from class com.db4o.io.BinDecorator
_bin
-
-
Constructor Summary
Constructors Constructor Description SynchronizedBin(Bin bin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
closes the BinDecorator and the underlyingBin
.long
length()
returns the length of the Bin (on disc, in memory).int
read(long position, byte[] buffer, 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();void
write(long position, byte[] bytes, int bytesToWrite)
writes a given number of bytes from an array of bytes at an offset position-
Methods inherited from class com.db4o.io.BinDecorator
syncRead
-
-
-
-
Constructor Detail
-
SynchronizedBin
public SynchronizedBin(Bin bin)
-
-
Method Detail
-
close
public void close()
Description copied from class:BinDecorator
closes the BinDecorator and the underlyingBin
.- Specified by:
close
in interfaceBin
- Overrides:
close
in classBinDecorator
-
length
public long length()
Description copied from interface:Bin
returns the length of the Bin (on disc, in memory).- Specified by:
length
in interfaceBin
- Overrides:
length
in classBinDecorator
- See Also:
Bin.length()
-
read
public int read(long position, byte[] buffer, int bytesToRead)
Description copied from interface:Bin
reads a given number of bytes into an array of bytes at an offset position.- Specified by:
read
in interfaceBin
- Overrides:
read
in classBinDecorator
- Parameters:
position
- the offset position to read atbuffer
- the byte array to read bytes intobytesToRead
- the number of bytes to be read- Returns:
- The number of bytes actually read (<= bytesToRead) or -1 if position already points to/exceeds the end of the bin
- See Also:
Bin.read(long, byte[], int)
-
write
public void write(long position, byte[] bytes, int bytesToWrite)
Description copied from interface:Bin
writes a given number of bytes from an array of bytes at an offset position- Specified by:
write
in interfaceBin
- Overrides:
write
in classBinDecorator
- Parameters:
position
- the offset position to write atbytes
- the array of bytes to writebytesToWrite
- the number of bytes to write- See Also:
Bin.write(long, byte[], int)
-
sync
public void sync()
Description copied from interface:Bin
flushes the buffer content to the physical storage media.- Specified by:
sync
in interfaceBin
- Overrides:
sync
in classBinDecorator
- See Also:
Bin.sync()
-
sync
public void sync(java.lang.Runnable runnable)
Description copied from interface:Bin
runs the Runnable between two calls to sync();- Specified by:
sync
in interfaceBin
- Overrides:
sync
in classBinDecorator
-
-