Class Value
- java.lang.Object
-
- oracle.kv.Value
-
- All Implemented Interfaces:
oracle.kv.impl.util.FastExternalizable
public class Value extends java.lang.Object implements oracle.kv.impl.util.FastExternalizableThe Value in a Key/Value store.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classValue.FormatIdentifies the format of a value.
-
Field Summary
Fields Modifier and Type Field Description static ValueEMPTY_VALUEAn instance that represents an empty value for key-only records.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ValuecreateValue(byte[] val)Creates a Value from a value byte array.booleanequals(java.lang.Object other)static ValuefromByteArray(byte[] bytes)Deserializes the given bytes that were returned earlier bytoByteArray()and returns the resulting Value.Value.FormatgetFormat()Returns the value's format.byte[]getValue()Returns the value byte array.inthashCode()byte[]toByteArray()Returns this Value as a serialized byte array, such thatfromByteArray(byte[])may be used to reconstitute the Value.java.lang.StringtoString()
-
-
-
Field Detail
-
EMPTY_VALUE
public static final Value EMPTY_VALUE
An instance that represents an empty value for key-only records.
-
-
Method Detail
-
toByteArray
public byte[] toByteArray()
Returns this Value as a serialized byte array, such thatfromByteArray(byte[])may be used to reconstitute the Value.The intended use case for the
toByteArray()andfromByteArray(byte[])methods is to serialize values of various formats in a uniform manner, for storage outside of NoSQL DB or for sending across a network.Values returned by calls to this method can be used with current and newer releases, but are not guaranteed to be compatible with earlier releases.
WARNING: The array returned by this method should be considered to be opaque by the caller. This array is not necessarily equal to the array returned by
getValue(); in particular, the returned array may contain an extra byte identifying the format. The only valid use of this array is to pass it tofromByteArray(byte[])at a later time in order to reconstruct theValueobject. NormallygetValue()should be used instead of this method.- See Also:
fromByteArray(byte[])
-
fromByteArray
public static Value fromByteArray(byte[] bytes)
Deserializes the given bytes that were returned earlier bytoByteArray()and returns the resulting Value.The intended use case for the
toByteArray()andfromByteArray(byte[])methods is to serialize values of various formats in a uniform manner, for storage outside of NoSQL DB or for sending across a network.Values created with either the current or earlier releases can be used with this method, but values created by later releases are not guaranteed to be compatible.
WARNING: Misuse of this method could result in data corruption if the returned object is added to the store. The array passed to this method must have been previously created by calling
fromByteArray(byte[]). To create aValueobject of formatValue.Format.NONE, callcreateValue(byte[])instead.- See Also:
toByteArray()
-
createValue
public static Value createValue(byte[] val)
Creates a Value from a value byte array. The format of the returned value isValue.Format.NONE.
-
getValue
public byte[] getValue()
Returns the value byte array.
-
getFormat
public Value.Format getFormat()
Returns the value's format.- Since:
- 2.0
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-