public class RrdRandomAccessFileBackend extends RrdBackend implements RrdFileBackend
| Modifier and Type | Field and Description |
|---|---|
protected RandomAccessFile | rafileRandom access file handle. |
BYTEORDER| Modifier | Constructor and Description |
|---|---|
protected | RrdRandomAccessFileBackend(String path,
boolean readOnly)Creates RrdFileBackend object for the given file path, backed by RandomAccessFile object. |
| Modifier and Type | Method and Description |
|---|---|
protected void | close()Closes the underlying RRD file. |
String | getCanonicalPath()Returns canonical path to the file on the disk. |
long | getLength()Returns the number of RRD bytes in the underlying storage. |
void | read(long offset,
byte[] b)Reads a number of bytes from the RRD file on the disk |
protected void | setLength(long length)Sets the number of bytes in the underlying RRD storage. |
protected void | write(long offset,
byte[] b)Writes bytes to the underlying RRD file on the disk |
done, getCharBuffer, getFactory, getPath, getUri, isCachingAllowed, isInstanceCreated, readAll, readDouble, readDouble, readInt, readLong, readShort, readString, rrdClose, writeDouble, writeDouble, writeDouble, writeInt, writeLong, writeShort, writeString, writeStringprotected final RandomAccessFile rafile
protected RrdRandomAccessFileBackend(String path, boolean readOnly) throws IOException
path - Path to a filereadOnly - True, if file should be open in a read-only mode. False otherwiseIOException - Thrown in case of I/O errorprotected void close()
throws IOExceptionclose in class RrdBackendIOException - Thrown in case of I/O errorpublic String getCanonicalPath()
RrdFileBackendgetCanonicalPath in interface RrdFileBackendpublic long getLength()
throws IOExceptiongetLength in class RrdBackendIOException - Thrown in case of I/O error.public void read(long offset,
byte[] b)
throws IOExceptionread in class RrdBackendoffset - Starting file offsetb - Buffer which receives bytes read from the file.IOException - Thrown in case of I/O error.protected void setLength(long length)
throws IOExceptionSets length of the underlying RRD file. This method is called only once, immediately after a new RRD file gets created.
setLength in class RrdBackendlength - Length of the underlying RRD storage in bytes.IOException - Thrown in case of I/O error.protected void write(long offset,
byte[] b)
throws IOExceptionwrite in class RrdBackendoffset - Starting file offsetb - Bytes to be written.IOException - Thrown in case of I/O error