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 protected
RrdMemoryBackend(String path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
This method is required by the base class definition, but it does not releases any memory resources at all.long
getLength()
Returns the number of RRD bytes held in memory.protected boolean
isCachingAllowed()
This method is overridden to disable high-level caching in frontend JRobin classes.protected void
read(long offset, byte[] b)
Reads an array of bytes from the underlying storage starting from the given storage offset.protected void
setLength(long newLength)
Reserves a memory section as a RRD storage.protected void
write(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:RrdBackend
Writes an array of bytes to the underlying storage starting from the given storage offset.- Specified by:
write
in 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 IOException
Description copied from class:RrdBackend
Reads an array of bytes from the underlying storage starting from the given storage offset.- Specified by:
read
in 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:
getLength
in classRrdBackend
- Returns:
- Number of all RRD bytes.
-
setLength
protected void setLength(long newLength) throws IOException
Reserves a memory section as a RRD storage.- Specified by:
setLength
in 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:
close
in classRrdBackend
-
isCachingAllowed
protected boolean isCachingAllowed()
This method is overridden to disable high-level caching in frontend JRobin classes.- Overrides:
isCachingAllowed
in classRrdBackend
- Returns:
- Always returns
false
. There is no need to cache anything in high-level classes since all RRD bytes are already in memory.
-
-