org.jrobin.core

Class RrdNioBackend

public class RrdNioBackend 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.
Constructor Summary
protected RrdNioBackend(String path, boolean readOnly, int syncPeriod)
Creates RrdFileBackend object for the given file path, backed by java.nio.* classes.
Method Summary
voidclose()
Closes the underlying RRD file.
protected voidread(long offset, byte[] b)
Reads a number of bytes from the RRD file on the disk
protected voidsetLength(long newLength)
Sets length of the underlying RRD file.
protected voidsync()
This method forces all data cached in memory but not yet stored in the file, to be stored in it.
protected voidwrite(long offset, byte[] b)
Writes bytes to the underlying RRD file on the disk

Constructor Detail

RrdNioBackend

protected RrdNioBackend(String path, boolean readOnly, int syncPeriod)
Creates RrdFileBackend object for the given file path, backed by java.nio.* classes.

Parameters: path Path to a file readOnly True, if file should be open in a read-only mode. False otherwise syncPeriod See RrdNioBackendFactory for explanation

Throws: IOException Thrown in case of I/O error

Method Detail

close

public void close()
Closes the underlying RRD file.

Throws: IOException Thrown in case of I/O error

read

protected void read(long offset, byte[] b)
Reads a number of bytes from the RRD file on the disk

Parameters: offset Starting file offset b Buffer which receives bytes read from the file.

setLength

protected void setLength(long newLength)
Sets length of the underlying RRD file. This method is called only once, immediately after a new RRD file gets created.

Parameters: newLength Length of the RRD file

Throws: IOException Thrown in case of I/O error.

sync

protected void sync()
This method forces all data cached in memory but not yet stored in the file, to be stored in it.

write

protected void write(long offset, byte[] b)
Writes bytes to the underlying RRD file on the disk

Parameters: offset Starting file offset b Bytes to be written.