Package org.h2.value

Class CharsetCollator

  • All Implemented Interfaces:
    java.lang.Cloneable, java.util.Comparator<java.lang.Object>

    public class CharsetCollator
    extends java.text.Collator
    The charset collator sorts strings according to the order in the given charset.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.charset.Charset charset  
      (package private) static java.util.Comparator<byte[]> COMPARATOR
      The comparator used to compare byte arrays.
      • Fields inherited from class java.text.Collator

        CANONICAL_DECOMPOSITION, FULL_DECOMPOSITION, IDENTICAL, NO_DECOMPOSITION, PRIMARY, SECONDARY, TERTIARY
    • Constructor Summary

      Constructors 
      Constructor Description
      CharsetCollator​(java.nio.charset.Charset charset)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.lang.String source, java.lang.String target)  
      java.nio.charset.Charset getCharset()  
      java.text.CollationKey getCollationKey​(java.lang.String source)  
      int hashCode()  
      (package private) byte[] toBytes​(java.lang.String source)
      Convert the source to bytes, using the character set.
      • Methods inherited from class java.text.Collator

        clone, compare, equals, equals, getAvailableLocales, getDecomposition, getInstance, getInstance, getStrength, setDecomposition, setStrength
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Field Detail

      • COMPARATOR

        static final java.util.Comparator<byte[]> COMPARATOR
        The comparator used to compare byte arrays.
      • charset

        private final java.nio.charset.Charset charset
    • Constructor Detail

      • CharsetCollator

        public CharsetCollator​(java.nio.charset.Charset charset)
    • Method Detail

      • getCharset

        public java.nio.charset.Charset getCharset()
      • compare

        public int compare​(java.lang.String source,
                           java.lang.String target)
        Specified by:
        compare in class java.text.Collator
      • toBytes

        byte[] toBytes​(java.lang.String source)
        Convert the source to bytes, using the character set.
        Parameters:
        source - the source
        Returns:
        the bytes
      • getCollationKey

        public java.text.CollationKey getCollationKey​(java.lang.String source)
        Specified by:
        getCollationKey in class java.text.Collator
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class java.text.Collator