org.rrd4j.core

## Class RrdPrimitive<U extends RrdUpdater<U>>

- java.lang.Object
- - org.rrd4j.core.RrdPrimitive<U>

- Type Parameters:
    `U` - The type of RrdUpdater this primitive belongs to
  Direct Known Subclasses:
    RrdDouble, RrdDoubleArray, RrdDoubleMatrix, RrdEnum, RrdInt, RrdLong, RrdString

      abstract class RrdPrimitive<U extends RrdUpdater<U>>
      extends Object

  Abstract base class for all RRD primitive data types.

  This class provides the foundation for storing different types of primitive data (int, long, double, string) in RRD files. It handles the low-level operations of reading and writing bytes to the backend storage, with support for caching and different data type sizes.

- - ### Field Summary

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RrdPrimitive(RrdUpdater<U> updater, int type, boolean isConstant)`
    `RrdPrimitive(RrdUpdater<U> updater, int type, int count, boolean isConstant)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) boolean` | `isCachingAllowed()` Checks if caching is allowed for this primitive.
    `(package private) byte[]` | `readBytes()`
    `(package private) double` | `readDouble()`
    `(package private) double` | `readDouble(int index)`
    `(package private) double[]` | `readDouble(int index, int count)`
    `protected <E extends Enum<E>> E` | `readEnum(Class<E> clazz)`
    `(package private) int` | `readInt()`
    `(package private) long` | `readLong()`
    `(package private) String` | `readString()`
    `(package private) void` | `writeBytes(byte[] b)`
    `(package private) void` | `writeDouble(double value)`
    `(package private) void` | `writeDouble(int index, double value)`
    `(package private) void` | `writeDouble(int index, double[] values)`
    `(package private) void` | `writeDouble(int index, double value, int count)`
    `protected <E extends Enum<E>> void` | `writeEnum(E value)`
    `(package private) void` | `writeInt(int value)`
    `(package private) void` | `writeLong(long value)`
    `(package private) void` | `writeString(String value)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### RRD_DOUBLE

          static final int RRD_DOUBLE

      Type identifier for double RRD primitives.
      See Also:
        Constant Field Values

    - #### RRD_INT

          static final int RRD_INT

      Type identifier for integer RRD primitives.
      See Also:
        Constant Field Values

    - #### RRD_LONG

          static final int RRD_LONG

      Type identifier for long RRD primitives.
      See Also:
        Constant Field Values

    - #### RRD_PRIM_SIZES

          static final int[] RRD_PRIM_SIZES

      Array containing the size in bytes for each RRD primitive type. Index corresponds to the type constants (RRD_INT, RRD_LONG, RRD_DOUBLE, RRD_STRING).

    - #### RRD_STRING

          static final int RRD_STRING

      Type identifier for string RRD primitives.
      See Also:
        Constant Field Values

    - #### STRING_LENGTH

          static final int STRING_LENGTH

      Maximum length of string values stored in RRD primitives.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RrdPrimitive

          RrdPrimitive(RrdUpdater<U> updater,
                       int type,
                       boolean isConstant)

    - #### RrdPrimitive

          RrdPrimitive(RrdUpdater<U> updater,
                       int type,
                       int count,
                       boolean isConstant)

  - ### Method Detail

    - #### isCachingAllowed

          final boolean isCachingAllowed()

      Checks if caching is allowed for this primitive.
      Returns:
        true if caching is allowed, false otherwise

    - #### readBytes

          final byte[] readBytes()
                          throws IOException

      Throws:
        `IOException`

    - #### readDouble

          final double readDouble()
                           throws IOException

      Throws:
        `IOException`

    - #### readDouble

          final double readDouble(int index)
                           throws IOException

      Throws:
        `IOException`

    - #### readDouble

          final double[] readDouble(int index,
                                    int count)
                             throws IOException

      Throws:
        `IOException`

    - #### readEnum

          protected final <E extends Enum<E>> E readEnum(Class<E> clazz)
                                                  throws IOException

      Throws:
        `IOException`

    - #### readInt

          final int readInt()
                     throws IOException

      Throws:
        `IOException`

    - #### readLong

          final long readLong()
                       throws IOException

      Throws:
        `IOException`

    - #### readString

          final String readString()
                           throws IOException

      Throws:
        `IOException`

    - #### writeBytes

          final void writeBytes(byte[] b)
                         throws IOException

      Throws:
        `IOException`

    - #### writeDouble

          final void writeDouble(double value)
                          throws IOException

      Throws:
        `IOException`

    - #### writeDouble

          final void writeDouble(int index,
                                 double value)
                          throws IOException

      Throws:
        `IOException`

    - #### writeDouble

          final void writeDouble(int index,
                                 double[] values)
                          throws IOException

      Throws:
        `IOException`

    - #### writeDouble

          final void writeDouble(int index,
                                 double value,
                                 int count)
                          throws IOException

      Throws:
        `IOException`

    - #### writeEnum

          protected final <E extends Enum<E>> void writeEnum(E value)
                                                      throws IOException

      Throws:
        `IOException`

    - #### writeInt

          final void writeInt(int value)
                       throws IOException

      Throws:
        `IOException`

    - #### writeLong

          final void writeLong(long value)
                        throws IOException

      Throws:
        `IOException`

    - #### writeString

          final void writeString(String value)
                          throws IOException

      Throws:
        `IOException`