Package org.h2.mvstore.db

# Class NullValueDataType

java.lang.Object
org.h2.mvstore.db.NullValueDataType

All Implemented Interfaces:
  `Comparator<Value>`, `DataType<Value>`

public final class NullValueDataType extends Object implements DataType<Value>
Dummy data type used when no value is required. This data type doesn't use any disk space and always returns SQL NULL value.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final NullValueDataType`
`INSTANCE`
Dummy data type instance.

## Method Summary

Modifier and Type
Method
Description
`int`
`binarySearch(Value key, Object storage, int size, int initialGuess)`
Perform binary search for the key within the storage
`int`
`compare(Value a, Value b)`
Compare two keys.
`Value[]`
`createStorage(int size)`
Create storage object of array type to hold values
`int`
`getMemory(Value obj)`
Calculates the amount of used memory in bytes.
`boolean`
`isMemoryEstimationAllowed()`
Whether memory estimation based on previously seen values is allowed/desirable
`Value`
`read(ByteBuffer buff)`
Read an object.
`void`
`read(ByteBuffer buff, Object storage, int len)`
Read a list of objects.
`void`
`write(WriteBuffer buff, Object storage, int len)`
Write a list of objects.
`void`
`write(WriteBuffer buff, Value obj)`
Write an object.

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

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

### Methods inherited from interface java.util.Comparator

`equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

## Field Details

### INSTANCE

public static final NullValueDataType INSTANCE
Dummy data type instance.

## Method Details

### compare

public int compare(Value a, Value b)
Description copied from interface: `DataType`
Compare two keys.

Specified by:
  `compare` in interface `Comparator<Value>`
Specified by:
  `compare` in interface `DataType<Value>`
Parameters:
  `a` - the first key
  `b` - the second key
Returns:
  -1 if the first key is smaller, 1 if larger, and 0 if equal

### binarySearch

public int binarySearch(Value key, Object storage, int size, int initialGuess)
Description copied from interface: `DataType`
Perform binary search for the key within the storage

Specified by:
  `binarySearch` in interface `DataType<Value>`
Parameters:
  `key` - to search for
  `storage` - to search within (an array of type T)
  `size` - number of data items in the storage
  `initialGuess` - for key position
Returns:
  index of the key , if found, - index of the insertion point, if not

### getMemory

public int getMemory(Value obj)
Description copied from interface: `DataType`
Calculates the amount of used memory in bytes.

Specified by:
  `getMemory` in interface `DataType<Value>`
Parameters:
  `obj` - the object
Returns:
  the used memory

### isMemoryEstimationAllowed

public boolean isMemoryEstimationAllowed()
Description copied from interface: `DataType`
Whether memory estimation based on previously seen values is allowed/desirable

Specified by:
  `isMemoryEstimationAllowed` in interface `DataType<Value>`
Returns:
  true if memory estimation is allowed

### write

public void write(WriteBuffer buff, Value obj)
Description copied from interface: `DataType`
Write an object.

Specified by:
  `write` in interface `DataType<Value>`
Parameters:
  `buff` - the target buffer
  `obj` - the value

### write

public void write(WriteBuffer buff, Object storage, int len)
Description copied from interface: `DataType`
Write a list of objects.

Specified by:
  `write` in interface `DataType<Value>`
Parameters:
  `buff` - the target buffer
  `storage` - the objects
  `len` - the number of objects to write

### read

public Value read(ByteBuffer buff)
Description copied from interface: `DataType`
Read an object.

Specified by:
  `read` in interface `DataType<Value>`
Parameters:
  `buff` - the source buffer
Returns:
  the object

### read

public void read(ByteBuffer buff, Object storage, int len)
Description copied from interface: `DataType`
Read a list of objects.

Specified by:
  `read` in interface `DataType<Value>`
Parameters:
  `buff` - the target buffer
  `storage` - the objects
  `len` - the number of objects to read

### createStorage

public Value[] createStorage(int size)
Description copied from interface: `DataType`
Create storage object of array type to hold values

Specified by:
  `createStorage` in interface `DataType<Value>`
Parameters:
  `size` - number of values to hold
Returns:
  storage object