Top Description Inners Fields Constructors Methods
org.h2.value

public Class CharsetCollator

extends Collator
Class Inheritance
Imports
java.nio.charset.Charset, java.text.CollationKey, .Collator, java.util.Arrays, .Locale

The charset collator sorts strings according to the order in the given charset.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final Charset
Inherited from java.text.Collator:
CANONICAL_DECOMPOSITIONFULL_DECOMPOSITIONIDENTICALNO_DECOMPOSITIONPRIMARYSECONDARYTERTIARY

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
compare(String
the source string.
source
,
String
the target string.
target
)

Implements abstract java.text.Collator.compare.

Implements java.util.Comparator.compare.

Compares the source string to the target string according to the collation rules for this Collator.

public Charset
public CollationKey
getCollationKey(String
the string to be transformed into a collation key.
source
)

Implements abstract java.text.Collator.getCollationKey.

Transforms the String into a series of bits that can be compared bitwise to other CollationKeys.

public int
hashCode()

Implements abstract java.text.Collator.hashCode.

Generates the hash code for this Collator.

pack-priv byte[]

Returns:

the bytes
toBytes
(String
the source
source
)

Convert the source to bytes, using the character set.

Inherited from java.text.Collator:
clonecompareequalsequalsgetAvailableLocalesgetDecompositiongetInstancegetInstancegetStrengthsetDecompositionsetStrength

Field Detail

charsetback to summary
private final Charset charset

Constructor Detail

CharsetCollatorback to summary
public CharsetCollator(Charset charset)

Method Detail

compareback to summary
public int compare(String source, String target)

Implements abstract java.text.Collator.compare.

Implements java.util.Comparator.compare.

Doc from java.text.Collator.compare.

Compares the source string to the target string according to the collation rules for this Collator. Returns an integer less than, equal to or greater than zero depending on whether the source String is less than, equal to or greater than the target string. See the Collator class description for an example of use.

For a one time comparison, this method has the best performance. If a given String will be involved in multiple comparisons, CollationKey.compareTo has the best performance. See the Collator class description for an example using CollationKeys.

Parameters
source:String

the source string.

target:String

the target string.

Returns:int

Returns an integer value. Value is less than zero if source is less than target, value is zero if source and target are equal, value is greater than zero if source is greater than target.

Annotations
@Override
getCharsetback to summary
public Charset getCharset()
getCollationKeyback to summary
public CollationKey getCollationKey(String source)

Implements abstract java.text.Collator.getCollationKey.

Doc from java.text.Collator.getCollationKey.

Transforms the String into a series of bits that can be compared bitwise to other CollationKeys. CollationKeys provide better performance than Collator.compare when Strings are involved in multiple comparisons. See the Collator class description for an example using CollationKeys.

Parameters
source:String

the string to be transformed into a collation key.

Returns:CollationKey

the CollationKey for the given String based on this Collator's collation rules. If the source String is null, a null CollationKey is returned.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Implements abstract java.text.Collator.hashCode.

Doc from java.text.Collator.hashCode.

Generates the hash code for this Collator.

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

Annotations
@Override
toBytesback to summary
pack-priv byte[] toBytes(String source)

Convert the source to bytes, using the character set.

Parameters
source:String

the source

Returns:byte[]

the bytes

org.h2.value back to summary

private Class CharsetCollator.CharsetCollationKey

extends CollationKey
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final byte[]

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(CollationKey
target CollationKey
target
)

Implements abstract java.text.CollationKey.compareTo.

Implements java.lang.Comparable.compareTo.

Compare this CollationKey to the target CollationKey.

public byte[]
toByteArray()

Implements abstract java.text.CollationKey.toByteArray.

Converts the CollationKey to a sequence of bits.

Inherited from java.text.CollationKey:
getSourceString

Field Detail

bytesback to summary
private final byte[] bytes

Constructor Detail

CharsetCollationKeyback to summary
pack-priv CharsetCollationKey(String source)

Method Detail

compareToback to summary
public int compareTo(CollationKey target)

Implements abstract java.text.CollationKey.compareTo.

Implements java.lang.Comparable.compareTo.

Doc from java.text.CollationKey.compareTo.

Compare this CollationKey to the target CollationKey. The collation rules of the Collator object which created these keys are applied

Note

CollationKeys created by different Collators can not be compared.

Parameters
target:CollationKey

target CollationKey

Returns:int

Returns an integer value. Value is less than zero if this is less than target, value is zero if this and target are equal and value is greater than zero if this is greater than target.

Annotations
@Override
toByteArrayback to summary
public byte[] toByteArray()

Implements abstract java.text.CollationKey.toByteArray.

Doc from java.text.CollationKey.toByteArray.

Converts the CollationKey to a sequence of bits. If two CollationKeys could be legitimately compared, then one could compare the byte arrays for each of those keys to obtain the same result. Byte arrays are organized most significant byte first.

Returns:byte[]

a byte array representation of the CollationKey

Annotations
@Override