org.rrd4j.core
Class RrdByteArrayBackend

java.lang.Object
  extended by org.rrd4j.core.RrdBackend
      extended by org.rrd4j.core.RrdByteArrayBackend
Direct Known Subclasses:
RrdBerkeleyDbBackend, RrdMemoryBackend, RrdMongoDBBackend

public abstract class RrdByteArrayBackend
extends RrdBackend

Abstract byte array based backend.


Field Summary
protected  byte[] buffer
           
 
Constructor Summary
protected RrdByteArrayBackend(String path)
           
 
Method Summary
 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 RRD4J classes.
protected  void read(long offset, byte[] bytes)
          Reads an array of bytes from the underlying storage starting from the given storage offset.
protected  void setLength(long length)
          Reserves a memory section as a RRD storage.
protected  void write(long offset, byte[] bytes)
          Writes an array of bytes to the underlying storage starting from the given storage offset.
 
Methods inherited from class org.rrd4j.core.RrdBackend
getPath, readAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected byte[] buffer
Constructor Detail

RrdByteArrayBackend

protected RrdByteArrayBackend(String path)
Method Detail

write

protected void write(long offset,
                     byte[] bytes)
              throws IOException
Description copied from class: RrdBackend
Writes an array of bytes to the underlying storage starting from the given storage offset.

Specified by:
write in class RrdBackend
Parameters:
offset - Storage offset.
bytes - Array of bytes that should be copied to the underlying storage
Throws:
IOException - Thrown in case of I/O error

read

protected void read(long offset,
                    byte[] bytes)
             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 class RrdBackend
Parameters:
offset - Storage offset.
bytes - 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 class RrdBackend
Returns:
Number of all RRD bytes.

setLength

protected void setLength(long length)
                  throws IOException
Reserves a memory section as a RRD storage.

Specified by:
setLength in class RrdBackend
Parameters:
length - Number of bytes held in memory.
Throws:
IOException - Thrown in case of I/O error.

close

public void close()
           throws IOException
This method is required by the base class definition, but it does not releases any memory resources at all.

Overrides:
close in class RrdBackend
Throws:
IOException - Thrown in case of I/O error

isCachingAllowed

protected boolean isCachingAllowed()
This method is overridden to disable high-level caching in frontend RRD4J classes.

Overrides:
isCachingAllowed in class RrdBackend
Returns:
Always returns false. There is no need to cache anything in high-level classes since all RRD bytes are already in memory.


Copyright © 2011. All Rights Reserved.