java.lang.Object
org.rrd4j.core.RrdPrimitive<U>
org.rrd4j.core.RrdDoubleArray<U>
Type Parameters:
U - The type of RrdUpdater this primitive belongs to

class RrdDoubleArray<U extends RrdUpdater<U>>extends RrdPrimitive<U>
RRD primitive type for handling arrays of double values.

This class provides methods to store and retrieve arrays of double values in RRD files. It extends RrdPrimitive to handle the low-level storage operations while providing array-specific access methods.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    Number of doubles the primitive occupies.

    Fields inherited from class RrdPrimitive

    RRD_DOUBLE, RRD_INT, RRD_LONG, RRD_PRIM_SIZES, RRD_STRING, STRING_LENGTH
    Modifier and Type
    Field
    Description
    (package private) static final int
    Type identifier for double RRD primitives.
    (package private) static final int
    Type identifier for integer RRD primitives.
    (package private) static final int
    Type identifier for long RRD primitives.
    (package private) static final int[]
    Array containing the size in bytes for each RRD primitive type.
    (package private) static final int
    Type identifier for string RRD primitives.
    (package private) static final int
    Maximum length of string values stored in RRD primitives.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RrdDoubleArray(RrdUpdater<U> updater, int length)
    Create a varying array-valued primitive.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    (package private) double
    get(int index)
    Gets a double value at the specified index.
    (package private) double[]
    get(int index, int count)
    Array of count double values starting at index.
    (package private) void
    set(int index, double value)
    Sets a double value at the specified index.
    (package private) void
    set(int index, double value, int count)
    Store one or more values starting at the given index.

    Methods inherited from class RrdPrimitive

    isCachingAllowed, readBytes, readDouble, readDouble, readDouble, readEnum, readInt, readLong, readString, writeBytes, writeDouble, writeDouble, writeDouble, writeDouble, writeEnum, writeInt, writeLong, writeString
    Modifier and Type
    Method
    Description
    (package private) final boolean
    Checks if caching is allowed for this primitive.
    (package private) final byte[]
    Raw byte array from backend storage.
    (package private) final double
    Reads the double value from backend storage.
    (package private) final double
    readDouble(int index)
    Position in the primitive array.
    (package private) final double[]
    readDouble(int index, int count)
    Starting position in the primitive array.
    protected final <E extends Enum<E>>
    E
    readEnum(Class<E> clazz)
    Deserialize an enum value from backend storage.
    (package private) final int
    Reads the int value from backend storage.
    (package private) final long
    Reads the long value from backend storage.
    (package private) final String
    Reads the string value from backend storage.
    (package private) final void
    writeBytes(byte[] b)
    Byte array to write to backend storage.
    (package private) final void
    writeDouble(double value)
    Double value to write to backend storage.
    (package private) final void
    writeDouble(int index, double value)
    Position in the primitive array.
    (package private) final void
    writeDouble(int index, double[] values)
    Starting position in the primitive array.
    (package private) final void
    writeDouble(int index, double value, int count)
    Starting position in the primitive array.
    protected final <E extends Enum<E>>
    void
    writeEnum(E value)
    Serialize an enum value to backend storage.
    (package private) final void
    writeInt(int value)
    Int value to write to backend storage.
    (package private) final void
    writeLong(long value)
    Long value to write to backend storage.
    (package private) final void
    String value to write to backend storage.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • length

      private final int length
      Number of doubles the primitive occupies.
  • Constructor Details

    • RrdDoubleArray

      RrdDoubleArray(RrdUpdater<U> updater, int length)
      Create a varying array-valued primitive.
      Parameters:
      updater - the source of values
      length - the number of slots in the array
  • Method Details

    • set

      void set(int index, double value) throws IOException
      Sets a double value at the specified index.
      Parameters:
      index - the index in the array
      value - the double value to set
      Throws:
      IOException - if an I/O error occurs
    • set

      void set(int index, double value, int count) throws IOException
      Store one or more values starting at the given index.
      Parameters:
      index - the slot to write at
      value - the value to write
      count - how many consecutive slots to fill
      Throws:
      IOException - if the underlying store cannot be written
    • get

      double get(int index) throws IOException
      Gets a double value at the specified index.
      Parameters:
      index - the index in the array
      Returns:
      the double value at the index
      Throws:
      IOException - if an I/O error occurs
    • get

      double[] get(int index, int count) throws IOException
      Array of count double values starting at index.
      Parameters:
      index - the index of the first value to read
      count - how many consecutive values to read, bounded by the array length
      Returns:
      a new array with the values copied out
      Throws:
      IOException - if the backing store cannot be read