Class WritableComparator

    • Method Detail

      • getKeyClass

        public Class<? extends WritableComparable> getKeyClass()
        Returns the WritableComparable implementation class.
      • compareBytes

        public static int compareBytes​(byte[] b1,
                                       int s1,
                                       int l1,
                                       byte[] b2,
                                       int s2,
                                       int l2)
        Lexicographic order of binary data.
      • hashBytes

        public static int hashBytes​(byte[] bytes,
                                    int offset,
                                    int length)
        Compute hash for binary data.
      • hashBytes

        public static int hashBytes​(byte[] bytes,
                                    int length)
        Compute hash for binary data.
      • readUnsignedShort

        public static int readUnsignedShort​(byte[] bytes,
                                            int start)
        Parse an unsigned short from a byte array.
      • readInt

        public static int readInt​(byte[] bytes,
                                  int start)
        Parse an integer from a byte array.
      • readFloat

        public static float readFloat​(byte[] bytes,
                                      int start)
        Parse a float from a byte array.
      • readLong

        public static long readLong​(byte[] bytes,
                                    int start)
        Parse a long from a byte array.
      • readDouble

        public static double readDouble​(byte[] bytes,
                                        int start)
        Parse a double from a byte array.
      • readVLong

        public static long readVLong​(byte[] bytes,
                                     int start)
                              throws IOException
        Reads a zero-compressed encoded long from a byte array and returns it.
        Parameters:
        bytes - byte array with decode long
        start - starting index
        Returns:
        deserialized long
        Throws:
        IOException
      • readVInt

        public static int readVInt​(byte[] bytes,
                                   int start)
                            throws IOException
        Reads a zero-compressed encoded integer from a byte array and returns it.
        Parameters:
        bytes - byte array with the encoded integer
        start - start index
        Returns:
        deserialized integer
        Throws:
        IOException