U - The type of RrdUpdater this primitive belongs toabstract class RrdPrimitive<U extends RrdUpdater<U>> extends Object
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.
| Modifier and Type | Field and Description |
|---|---|
(package private) static int | RRD_DOUBLEType identifier for double RRD primitives. |
(package private) static int | RRD_INTType identifier for integer RRD primitives. |
(package private) static int | RRD_LONGType identifier for long RRD primitives. |
(package private) static int[] | RRD_PRIM_SIZESArray containing the size in bytes for each RRD primitive type. |
(package private) static int | RRD_STRINGType identifier for string RRD primitives. |
(package private) static int | STRING_LENGTHMaximum length of string values stored in RRD primitives. |
| Constructor and Description |
|---|
RrdPrimitive(RrdUpdater<U> updater,
int type,
boolean isConstant) |
RrdPrimitive(RrdUpdater<U> updater,
int type,
int count,
boolean isConstant) |
| Modifier and Type | Method and Description |
|---|---|
(package private) boolean | isCachingAllowed()Checks if caching is allowed for this primitive. |
(package private) byte[] | readBytes()Raw byte array from backend storage. |
(package private) double | readDouble()Double value from backend storage. |
(package private) double | readDouble(int index)Position in the primitive array. |
(package private) double[] | readDouble(int index,
int count)Starting position in the primitive array. |
protected <E extends Enum<E>> | readEnum(Class<E> clazz)Deserialize an enum value from backend storage. |
(package private) int | readInt()Int value from backend storage. |
(package private) long | readLong()Long value from backend storage. |
(package private) String | readString()String value from backend storage. |
(package private) void | writeBytes(byte[] b)Byte array to write to backend storage. |
(package private) void | writeDouble(double value)Double value to write to backend storage. |
(package private) void | writeDouble(int index,
double value)Position in the primitive array. |
(package private) void | writeDouble(int index,
double[] values)Starting position in the primitive array. |
(package private) void | writeDouble(int index,
double value,
int count)Starting position in the primitive array. |
protected <E extends Enum<E>> | writeEnum(E value)Serialize an enum value to backend storage. |
(package private) void | writeInt(int value)Int value to write to backend storage. |
(package private) void | writeLong(long value)Long value to write to backend storage. |
(package private) void | writeString(String value)String value to write to backend storage. |
static final int RRD_DOUBLE
static final int RRD_INT
static final int RRD_LONG
static final int[] RRD_PRIM_SIZES
static final int RRD_STRING
static final int STRING_LENGTH
RrdPrimitive(RrdUpdater<U> updater, int type, boolean isConstant)
RrdPrimitive(RrdUpdater<U> updater, int type, int count, boolean isConstant)
final boolean isCachingAllowed()
final byte[] readBytes()
throws IOExceptionIOExceptionfinal double readDouble()
throws IOExceptionIOExceptionfinal double readDouble(int index)
throws IOExceptionindex - position in the primitive arrayIOExceptionfinal double[] readDouble(int index,
int count)
throws IOExceptionindex - starting position in the primitive arraycount - number of consecutive doubles to readIOExceptionprotected final <E extends Enum<E>> E readEnum(Class<E> clazz) throws IOException
E - enum typeclazz - enum class to deserializeIOExceptionfinal int readInt()
throws IOExceptionIOExceptionfinal long readLong()
throws IOExceptionIOExceptionfinal String readString() throws IOException
IOExceptionfinal void writeBytes(byte[] b)
throws IOExceptionb - byte array to write to backend storageIOExceptionfinal void writeDouble(double value)
throws IOExceptionvalue - double value to write to backend storageIOExceptionfinal void writeDouble(int index,
double value)
throws IOExceptionindex - position in the primitive arrayvalue - double value to writeIOExceptionfinal void writeDouble(int index,
double[] values)
throws IOExceptionindex - starting position in the primitive arrayvalues - array of doubles to writeIOExceptionfinal void writeDouble(int index,
double value,
int count)
throws IOExceptionindex - starting position in the primitive arrayvalue - double value to writecount - number of consecutive slots to fillIOExceptionprotected final <E extends Enum<E>> void writeEnum(E value) throws IOException
IOExceptionfinal void writeInt(int value)
throws IOExceptionvalue - int value to write to backend storageIOExceptionfinal void writeLong(long value)
throws IOExceptionvalue - long value to write to backend storageIOExceptionfinal void writeString(String value) throws IOException
value - string value to write to backend storageIOException