Package org.jrobin.core
Class RrdMemoryBackend
- java.lang.Object
-
- org.jrobin.core.RrdBackend
-
- org.jrobin.core.RrdMemoryBackend
-
public class RrdMemoryBackend extends RrdBackend
Backend to be used to store all RRD bytes in memory.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRrdMemoryBackend(String path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()This method is required by the base class definition, but it does not releases any memory resources at all.longgetLength()Returns the number of RRD bytes held in memory.protected booleanisCachingAllowed()This method is overridden to disable high-level caching in frontend JRobin classes.protected voidread(long offset, byte[] b)Reads an array of bytes from the underlying storage starting from the given storage offset.protected voidsetLength(long newLength)Reserves a memory section as a RRD storage.protected voidwrite(long offset, byte[] b)Writes an array of bytes to the underlying storage starting from the given storage offset.-
Methods inherited from class org.jrobin.core.RrdBackend
getPath, isInstanceCreated, isReadOnly, readAll, readDouble, readDouble, readInt, readLong, readString, writeDouble, writeDouble, writeDouble, writeInt, writeLong, writeString
-
-
-
-
Constructor Detail
-
RrdMemoryBackend
protected RrdMemoryBackend(String path)
-
-
Method Detail
-
write
protected void write(long offset, byte[] b)Description copied from class:RrdBackendWrites an array of bytes to the underlying storage starting from the given storage offset.- Specified by:
writein classRrdBackend- Parameters:
offset- Storage offset.b- Array of bytes that should be copied to the underlying storage
-
read
protected void read(long offset, byte[] b) throws IOExceptionDescription copied from class:RrdBackendReads an array of bytes from the underlying storage starting from the given storage offset.- Specified by:
readin classRrdBackend- Parameters:
offset- Storage offset.b- Array which receives bytes from the underlying storage- Throws:
IOException- Thrown in case of I/O error
-
getLength
public long getLength()
Returns the number of RRD bytes held in memory.- Specified by:
getLengthin classRrdBackend- Returns:
- Number of all RRD bytes.
-
setLength
protected void setLength(long newLength) throws IOExceptionReserves a memory section as a RRD storage.- Specified by:
setLengthin classRrdBackend- Parameters:
newLength- Number of bytes held in memory.- Throws:
IOException- Thrown in case of I/O error.
-
close
public void close()
This method is required by the base class definition, but it does not releases any memory resources at all.- Overrides:
closein classRrdBackend
-
isCachingAllowed
protected boolean isCachingAllowed()
This method is overridden to disable high-level caching in frontend JRobin classes.- Overrides:
isCachingAllowedin classRrdBackend- Returns:
- Always returns
false. There is no need to cache anything in high-level classes since all RRD bytes are already in memory.
-
-