public abstract class ByteBufferBackend extends RrdBackend
ByteBuffer, using java
internal methods for long, integer and others types.BYTEORDER| Modifier | Constructor and Description |
|---|---|
protected | ByteBufferBackend(String path)Constructs a ByteBufferBackend with the given file path. |
| Modifier and Type | Method and Description |
|---|---|
protected void | close()Closes the underlying backend. |
protected CharBuffer | getCharBuffer(long offset,
int size)Extract a CharBuffer from the backend, used by readString |
protected boolean | isDirty()Check whether the buffer has been modified since the last sync. |
protected void | read(long offset,
byte[] b)Reads a number of bytes from the RRD file on the disk |
double | readDouble(long offset)Reads a double value from the underlying storage at the given offset. |
double[] | readDouble(long offset,
int count)Reads an array of double values from the underlying storage at the given offset. |
protected int | readInt(long offset)Reads an integer value from the underlying storage at the given offset. |
protected long | readLong(long offset)Reads a long value from the underlying storage at the given offset. |
protected short | readShort(long offset)Reads a short value from the underlying storage at the given offset. |
protected void | rrdClose()Closes the underlying backend. |
protected void | setByteBuffer(ByteBuffer byteBuffer)Set the byte buffer to use for backing storage. |
protected void | write(long offset,
byte[] b)Writes bytes to the underlying RRD file on the disk |
protected void | writeDouble(long offset,
double value)Writes a double value to the underlying storage at the given offset. |
protected void | writeDouble(long offset,
double[] values)Writes an array of double values to the underlying storage at the given offset. |
protected void | writeDouble(long offset,
double value,
int count)Writes multiple copies of a double value to the underlying storage at the given offset. |
protected void | writeInt(long offset,
int value)Writes an integer value to the underlying storage at the given offset. |
protected void | writeLong(long offset,
long value)Writes a long value to the underlying storage at the given offset. |
protected void | writeShort(long offset,
short value)Writes a short value to the underlying storage at the given offset. |
protected void | writeString(long offset,
String value,
int length)Writes a string to the underlying storage at the given offset with a fixed length. |
done, getFactory, getLength, getPath, getUri, isCachingAllowed, isInstanceCreated, readAll, readString, setLength, writeStringprotected ByteBufferBackend(String path)
path - the file pathprotected void close()
throws IOExceptionRrdBackendclose in class RrdBackendIOException - Thrown in case of I/O errorprotected CharBuffer getCharBuffer(long offset, int size) throws RrdException
RrdBackendgetCharBuffer in class RrdBackendoffset - the offset in the rrdsize - the size of the buffer, in characterRrdExceptionprotected boolean isDirty()
protected 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.IllegalArgumentException - if offset is bigger that the possible mapping
position (2GiB).public double readDouble(long offset)
throws IOExceptionRrdBackendreadDouble in class RrdBackendoffset - Storage offset.IOException - Thrown in case of I/O error.public double[] readDouble(long offset,
int count)
throws IOExceptionRrdBackendreadDouble in class RrdBackendoffset - Storage offset.count - Number of double values to read.IOException - Thrown in case of I/O error.protected int readInt(long offset)
throws IOExceptionRrdBackendreadInt in class RrdBackendoffset - Storage offset.IOException - Thrown in case of I/O error.protected long readLong(long offset)
throws IOExceptionRrdBackendreadLong in class RrdBackendoffset - Storage offset.IOException - Thrown in case of I/O error.protected short readShort(long offset)
throws IOExceptionRrdBackendreadShort in class RrdBackendoffset - Storage offset.IOException - Thrown in case of I/O error.protected void rrdClose()
throws IOExceptionRrdBackendRrdDb#close() when it's closed. All subclass
must keep calling it.rrdClose in class RrdBackendIOException - Thrown in case of I/O errorprotected void setByteBuffer(ByteBuffer byteBuffer)
byteBuffer - the byte buffer to setprotected void write(long offset,
byte[] b)
throws IOExceptionwrite in class RrdBackendoffset - Starting file offsetb - Bytes to be written.IOException - if any.IllegalArgumentException - if offset is bigger that the possible mapping
position (2GiB).protected void writeDouble(long offset,
double value)
throws IOExceptionRrdBackendwriteDouble in class RrdBackendoffset - Storage offset.value - Double value to write.IOException - Thrown in case of I/O error.protected void writeDouble(long offset,
double[] values)
throws IOExceptionRrdBackendwriteDouble in class RrdBackendoffset - Storage offset.values - Array of double values to write.IOException - Thrown in case of I/O error.protected void writeDouble(long offset,
double value,
int count)
throws IOExceptionRrdBackendwriteDouble in class RrdBackendoffset - Storage offset.value - Double value to write.count - Number of times to write the value.IOException - Thrown in case of I/O error.protected void writeInt(long offset,
int value)
throws IOExceptionRrdBackendwriteInt in class RrdBackendoffset - Storage offset.value - Integer value to write.IOException - Thrown in case of I/O error.protected void writeLong(long offset,
long value)
throws IOExceptionRrdBackendwriteLong in class RrdBackendoffset - Storage offset.value - Long value to write.IOException - Thrown in case of I/O error.protected void writeShort(long offset,
short value)
throws IOExceptionRrdBackendwriteShort in class RrdBackendoffset - Storage offset.value - Short value to write.IOException - Thrown in case of I/O error.protected void writeString(long offset,
String value,
int length)
throws IOExceptionRrdBackendwriteString in class RrdBackendoffset - Storage offset.value - String value to write.length - Fixed length for the string storage.IOException - Thrown in case of I/O error.