Package org.jrobin.core
Class RrdNioByteBufferBackend
- java.lang.Object
-
- org.jrobin.core.RrdBackend
-
- org.jrobin.core.RrdFileBackend
-
- org.jrobin.core.RrdNioByteBufferBackend
-
public class RrdNioByteBufferBackend extends RrdFileBackend
JRobin backend which is used to store RRD data to ordinary disk files by using fast java.nio.* package. This is the default backend engine since JRobin 1.4.0.
-
-
Field Summary
-
Fields inherited from class org.jrobin.core.RrdFileBackend
file
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRrdNioByteBufferBackend(String path, boolean readOnly)Creates RrdFileBackend object for the given file path, backed by java.nio.* classes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying RRD file.protected voidread(long offset, byte[] b)Reads a number of bytes from the RRD file on the diskprotected voidsetLength(long newLength)Sets length of the underlying RRD file.protected voidwrite(long offset, byte[] b)Writes bytes to the underlying RRD file on the disk-
Methods inherited from class org.jrobin.core.RrdFileBackend
getCanonicalPath, getCanonicalPath, getLength
-
Methods inherited from class org.jrobin.core.RrdBackend
getPath, isCachingAllowed, isInstanceCreated, isReadOnly, readAll, readDouble, readDouble, readInt, readLong, readString, writeDouble, writeDouble, writeDouble, writeInt, writeLong, writeString
-
-
-
-
Constructor Detail
-
RrdNioByteBufferBackend
protected RrdNioByteBufferBackend(String path, boolean readOnly) throws IOException, IllegalStateException
Creates RrdFileBackend object for the given file path, backed by java.nio.* classes.- Parameters:
path- Path to a filereadOnly- True, if file should be open in a read-only mode. False otherwise- Throws:
IOException- Thrown in case of I/O errorIllegalStateException
-
-
Method Detail
-
setLength
protected void setLength(long newLength) throws IOExceptionSets length of the underlying RRD file. This method is called only once, immediately after a new RRD file gets created.- Overrides:
setLengthin classRrdFileBackend- Parameters:
newLength- Length of the RRD file- Throws:
IOException- Thrown in case of I/O error.
-
write
protected void write(long offset, byte[] b)Writes bytes to the underlying RRD file on the disk- Overrides:
writein classRrdFileBackend- Parameters:
offset- Starting file offsetb- Bytes to be written.
-
read
protected void read(long offset, byte[] b)Reads a number of bytes from the RRD file on the disk- Overrides:
readin classRrdFileBackend- Parameters:
offset- Starting file offsetb- Buffer which receives bytes read from the file.
-
close
public void close() throws IOExceptionCloses the underlying RRD file.- Overrides:
closein classRrdFileBackend- Throws:
IOException- Thrown in case of I/O error
-
-