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) |
| 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() |
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) |
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)
protected void close()
throws IOException
RrdBackendclose 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 IOException
read 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 IOException
RrdBackendreadDouble in class RrdBackendoffset - Storage offset.IOException - Thrown in case of I/O error.public double[] readDouble(long offset,
int count)
throws IOException
RrdBackendreadDouble 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 IOException
RrdBackendreadInt in class RrdBackendoffset - Storage offset.IOException - Thrown in case of I/O error.protected long readLong(long offset)
throws IOException
RrdBackendreadLong in class RrdBackendoffset - Storage offset.IOException - Thrown in case of I/O error.protected short readShort(long offset)
throws IOException
RrdBackendreadShort in class RrdBackendoffset - Storage offset.IOException - Thrown in case of I/O error.protected void rrdClose()
throws IOException
RrdBackendRrdDb#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)
protected void write(long offset,
byte[] b)
throws IOException
write 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 IOException
RrdBackendwriteDouble 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 IOException
RrdBackendwriteDouble 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 IOException
RrdBackendwriteDouble 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 IOException
RrdBackendwriteInt 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 IOException
RrdBackendwriteLong 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 IOException
RrdBackendwriteShort 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 IOException
RrdBackendwriteString 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.