Top Description Inners Fields Constructors Methods
org.h2.mvstore.type

public Class ObjectDataType

extends BasicDataType<Object>
Class Inheritance
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .ObjectInputStream, .ObjectOutputStream, java.lang.reflect.Array, java.math.BigDecimal, .BigInteger, java.nio.ByteBuffer, java.util.Arrays, .Date, .HashMap, .UUID, org.h2.mvstore.DataUtils, .WriteBuffer, org.h2.util.Utils

A data type implementation for the most common data types, including serializable objects.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv abstract static class
ObjectDataType.AutoDetectDataType<T>

The base class for auto-detect data types.

pack-priv static class
ObjectDataType.BigDecimalType

The type for BigDecimal objects.

pack-priv static class
ObjectDataType.BigIntegerType

The type for BigInteger objects.

pack-priv static class
ObjectDataType.BooleanType

The type for boolean true and false.

pack-priv static class
ObjectDataType.ByteType

The type for byte objects.

pack-priv static class
ObjectDataType.CharacterType

The type for character objects.

pack-priv static class
ObjectDataType.DateType

The type for java.util.Date objects.

pack-priv static class
ObjectDataType.DoubleType

The type for double objects.

pack-priv static class
ObjectDataType.FloatType

The type for float objects.

private static class
pack-priv static class
ObjectDataType.IntegerType

The type for integer objects.

pack-priv static class
ObjectDataType.LongType

The type for long objects.

pack-priv static class
ObjectDataType.NullType

The type for the null value

pack-priv static class
ObjectDataType.ObjectArrayType

The type for object arrays.

pack-priv static class
ObjectDataType.SerializedObjectType

The type for serialized objects.

pack-priv static class
ObjectDataType.ShortType

The type for short objects.

pack-priv static class
ObjectDataType.StringType

The type for string objects.

pack-priv static class
ObjectDataType.UUIDType

The type for UUID objects.

Field Summary

Modifier and TypeField and Description
pack-priv static final Class<?>[]
pack-priv static final long
pack-priv static final long
pack-priv static final int
pack-priv static final int
FLOAT_ZERO_BITS

Constants for floating point synchronization.

private ObjectDataType.AutoDetectDataType<Object>
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
TAG_BOOLEAN_TRUE

For very common values (e.g. 0 and 1) we save space by encoding the value in the tag.

pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
TAG_INTEGER_0_15

For small-values/small-arrays, we encode the value/array-length in the tag.

pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
TYPE_NULL

The type constants are also used as tag values.

pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
compare(Object
the first key
a
,
Object
the second key
b
)

Overrides org.h2.mvstore.type.BasicDataType.compare.

Implements org.h2.mvstore.type.DataType.compare.

Compare two keys.

public static int

Returns:

the result of the comparison (-1, 1 or 0)
compareNotNull
(byte[]
the first byte array (must not be null)
data1
,
byte[]
the second byte array (must not be null)
data2
)

Compare the contents of two byte arrays.

public Object[]
createStorage(int
number of values to hold
size
)

Implements org.h2.mvstore.type.DataType.createStorage.

Create storage object of array type to hold values

public static Object

Returns:

the object
deserialize
(byte[]
the byte array
data
)

De-serialize the byte array to an object.

public int
getMemory(Object
the object
obj
)

Implements abstract org.h2.mvstore.type.BasicDataType.getMemory.

Implements org.h2.mvstore.type.DataType.getMemory.

Calculates the amount of used memory in bytes.

private static int
pack-priv static boolean

Returns:

true if yes
isArray
(Object
the object
obj
)

Check whether this object is an array.

pack-priv static boolean

Returns:

true if yes
isBigDecimal
(Object
the object
obj
)

Check whether this object is a BigDecimal.

pack-priv static boolean

Returns:

true if yes
isBigInteger
(Object
the object
obj
)

Check whether this object is a BigInteger.

pack-priv static boolean

Returns:

true if yes
isDate
(Object
the object
obj
)

Check whether this object is a date.

private ObjectDataType.AutoDetectDataType<Object>
newType(int typeId)

public Object
read(ByteBuffer
the source buffer
buff
)

Implements abstract org.h2.mvstore.type.BasicDataType.read.

Implements org.h2.mvstore.type.DataType.read.

Read an object.

private ObjectDataType.AutoDetectDataType<T>
selectDataType(int typeId)

public static byte[]

Returns:

the byte array
serialize
(Object
the object to serialize
obj
)

Serialize the object to a byte array.

pack-priv ObjectDataType.AutoDetectDataType<Object>

Returns:

the auto-detected type used
switchType
(Object
the object
obj
)

Switch the last remembered type to match the type of the given object.

public void
write(WriteBuffer
the target buffer
buff
,
Object
the value
obj
)

Implements abstract org.h2.mvstore.type.BasicDataType.write.

Implements org.h2.mvstore.type.DataType.write.

Write an object.

Inherited from org.h2.mvstore.type.BasicDataType:
binarySearchcastequalshashCodeisMemoryEstimationAllowedreadwrite