public class

RrdFileBackend

extends RrdBackend
java.lang.Object
   ↳ org.rrd4j.core.RrdBackend
     ↳ org.rrd4j.core.RrdFileBackend
Known Direct Subclasses

Class Overview

Backend which is used to store RRD data to ordinary files on the disk. This was the default factory before 1.4.0 version. This backend is based on the RandomAccessFile class (java.io.* package).

Summary

Fields
protected final RandomAccessFile file Random access file handle.
protected final boolean readOnly Read/write file status.
Protected Constructors
RrdFileBackend(String path, boolean readOnly)
Creates RrdFileBackend object for the given file path, backed by RandomAccessFile object.
Public Methods
void close()
Closes the underlying RRD file.
static String getCanonicalPath(String path)
Returns canonical path to the file on the disk.
String getCanonicalPath()
Returns canonical path to the file on the disk.
long getLength()
Returns RRD file length.
Protected Methods
void read(long offset, byte[] b)
Reads a number of bytes from the RRD file on the disk
void setLength(long length)
Sets length of the underlying RRD file.
void write(long offset, byte[] b)
Writes bytes to the underlying RRD file on the disk
[Expand]
Inherited Methods
From class org.rrd4j.core.RrdBackend
From class java.lang.Object

Fields

protected final RandomAccessFile file

Random access file handle.

protected final boolean readOnly

Read/write file status.

Protected Constructors

protected RrdFileBackend (String path, boolean readOnly)

Creates RrdFileBackend object for the given file path, backed by RandomAccessFile object.

Parameters
path Path to a file
readOnly True, if file should be open in a read-only mode. False otherwise
Throws
IOException Thrown in case of I/O error

Public Methods

public void close ()

Closes the underlying RRD file.

Throws
IOException Thrown in case of I/O error

public static String getCanonicalPath (String path)

Returns canonical path to the file on the disk.

Parameters
path File path
Returns
  • Canonical file path
Throws
IOException Thrown in case of I/O error

public String getCanonicalPath ()

Returns canonical path to the file on the disk.

Returns
  • Canonical file path
Throws
IOException Thrown in case of I/O error

public long getLength ()

Returns RRD file length.

Returns
  • File length.
Throws
IOException Thrown in case of I/O error.

Protected Methods

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.
Throws
IOException Thrown in case of I/O error.

protected void setLength (long length)

Sets length of the underlying RRD file. This method is called only once, immediately after a new RRD file gets created.

Parameters
length Length of the RRD file
Throws
IOException Thrown in case of I/O error.

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.
Throws
IOException Thrown in case of I/O error