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

public Class StringDataType

extends BasicDataType<String>
Class Inheritance
Imports
java.nio.ByteBuffer, org.h2.mvstore.DataUtils, .WriteBuffer

A string type.

Field Summary

Modifier and TypeField and Description
private static final String[]
public static final StringDataType

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
binarySearch(String
to search for
key
,
Object
to search within (an array of type T)
storageObj
,
int
number of data items in the storage
size
,
int
for key position
initialGuess
)

Overrides org.h2.mvstore.type.BasicDataType.binarySearch.

Implements org.h2.mvstore.type.DataType.binarySearch.

Perform binary search for the key within the storage

public int
compare(String
the first key
a
,
String
the second key
b
)

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

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

Compare two keys.

public String[]
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 int
getMemory(String
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.

public String
read(ByteBuffer
the source buffer
buff
)

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

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

Read an object.

public void
write(WriteBuffer
the target buffer
buff
,
String
the value
s
)

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:
castequalshashCodeisMemoryEstimationAllowedreadwrite

Field Detail

EMPTY_STRING_ARRback to summary
private static final String[] EMPTY_STRING_ARR
INSTANCEback to summary
public static final StringDataType INSTANCE

Constructor Detail

StringDataTypeback to summary
public StringDataType()

Method Detail

binarySearchback to summary
public int binarySearch(String key, Object storageObj, int size, int initialGuess)

Overrides org.h2.mvstore.type.BasicDataType.binarySearch.

Implements org.h2.mvstore.type.DataType.binarySearch.

Doc from org.h2.mvstore.type.DataType.binarySearch.

Perform binary search for the key within the storage

Parameters
key:String

to search for

storageObj:Object

to search within (an array of type T)

size:int

number of data items in the storage

initialGuess:int

for key position

Returns:int

index of the key , if found, - index of the insertion point, if not

Annotations
@Override
compareback to summary
public int compare(String a, String b)

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

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

Doc from org.h2.mvstore.type.DataType.compare.

Compare two keys.

Parameters
a:String

the first key

b:String

the second key

Returns:int

-1 if the first key is smaller, 1 if larger, and 0 if equal

Annotations
@Override
createStorageback to summary
public String[] createStorage(int size)

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

Doc from org.h2.mvstore.type.DataType.createStorage.

Create storage object of array type to hold values

Parameters
size:int

number of values to hold

Returns:String[]

storage object

Annotations
@Override
getMemoryback to summary
public int getMemory(String obj)

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

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

Doc from org.h2.mvstore.type.DataType.getMemory.

Calculates the amount of used memory in bytes.

Parameters
obj:String

the object

Returns:int

the used memory

Annotations
@Override
readback to summary
public String read(ByteBuffer buff)

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

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

Doc from org.h2.mvstore.type.DataType.read.

Read an object.

Parameters
buff:ByteBuffer

the source buffer

Returns:String

the object

Annotations
@Override
writeback to summary
public void write(WriteBuffer buff, String s)

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

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

Doc from org.h2.mvstore.type.DataType.write.

Write an object.

Parameters
buff:WriteBuffer

the target buffer

s:String

the value

Annotations
@Override