Package org.rrd4j.core
Class RrdByteArrayBackend
- java.lang.Object
-
- org.rrd4j.core.RrdBackend
-
- org.rrd4j.core.ByteBufferBackend
-
- org.rrd4j.core.RrdByteArrayBackend
-
public abstract class RrdByteArrayBackend extends ByteBufferBackend
Abstract byte array based backend.
-
-
Field Summary
-
Fields inherited from class org.rrd4j.core.RrdBackend
BYTEORDER
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RrdByteArrayBackend(String path)
Constructor for RrdByteArrayBackend.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]
getBuffer()
long
getLength()
Returns the number of RRD bytes in the underlying storage.protected void
read(long offset, byte[] bytes)
read.protected void
setBuffer(byte[] buffer)
protected void
setLength(long length)
Sets the number of bytes in the underlying RRD storage.-
Methods inherited from class org.rrd4j.core.ByteBufferBackend
close, getCharBuffer, isDirty, readDouble, readDouble, readInt, readLong, readShort, rrdClose, setByteBuffer, write, writeDouble, writeDouble, writeDouble, writeInt, writeLong, writeShort, writeString
-
Methods inherited from class org.rrd4j.core.RrdBackend
done, getFactory, getPath, getUri, isCachingAllowed, isInstanceCreated, readAll, readString, writeString
-
-
-
-
Method Detail
-
setBuffer
protected void setBuffer(byte[] buffer)
-
getBuffer
protected byte[] getBuffer()
-
read
protected void read(long offset, byte[] bytes) throws IOException
read.
- Overrides:
read
in classByteBufferBackend
- Parameters:
offset
- a long.bytes
- an array of byte.- Throws:
IOException
- if any.IllegalArgumentException
- if offset is bigger that the possible length.
-
getLength
public long getLength()
Returns the number of RRD bytes in the underlying storage.- Specified by:
getLength
in classRrdBackend
- Returns:
- Number of RRD bytes held in memory.
-
setLength
protected void setLength(long length) throws IOException
Sets the number of bytes in the underlying RRD storage. This method is called only once, immediately after a new RRD storage gets created.It will reserves a memory section as a RRD storage.
- Specified by:
setLength
in classRrdBackend
- Parameters:
length
- Length of the underlying RRD storage in bytes.- Throws:
IllegalArgumentException
- if length is bigger that the possible length.IOException
- Thrown in case of I/O error.
-
-