Package herddb.utils

Class Bytes

    • Field Detail

      • POSITIVE_INFINITY

        public static final Bytes POSITIVE_INFINITY
      • EMPTY_ARRAY

        public static final Bytes EMPTY_ARRAY
      • deserialized

        public Object deserialized
    • Method Detail

      • estimateSize

        public static long estimateSize​(byte[] value)
      • getEstimatedSize

        public long getEstimatedSize()
        Description copied from interface: SizeAwareObject
        Returns an estimation of the heap size of this instance.
        Specified by:
        getEstimatedSize in interface SizeAwareObject
        Returns:
        size estimation in bytes
      • string_to_array

        public static byte[] string_to_array​(String s)
      • from_string

        public static Bytes from_string​(String s)
      • longToByteArray

        public static byte[] longToByteArray​(long value)
      • intToByteArray

        public static byte[] intToByteArray​(int value)
      • doubleToByteArray

        public static byte[] doubleToByteArray​(double value)
      • timestampToByteArray

        public static byte[] timestampToByteArray​(Timestamp value)
      • booleanToByteArray

        public static byte[] booleanToByteArray​(boolean value)
      • from_long

        public static Bytes from_long​(long value)
      • from_array

        public static Bytes from_array​(byte[] data)
      • from_array

        public static Bytes from_array​(byte[] data,
                                       int offset,
                                       int len)
      • from_nullable_array

        public static Bytes from_nullable_array​(byte[] data)
      • to_array

        public byte[] to_array()
      • to_float_array

        public float[] to_float_array()
      • to_float_array

        public static float[] to_float_array​(byte[] buffer,
                                             int offset,
                                             int length)
      • from_float_array

        public static Bytes from_float_array​(float[] floatArray)
      • from_int

        public static Bytes from_int​(int value)
      • from_timestamp

        public static Bytes from_timestamp​(Timestamp value)
      • from_boolean

        public static Bytes from_boolean​(boolean value)
      • from_double

        public static Bytes from_double​(double value)
      • to_long

        public long to_long()
      • to_RawString

        public RawString to_RawString()
      • to_int

        public int to_int()
      • to_string

        public String to_string()
      • to_string

        public static String to_string​(byte[] data)
      • to_rawstring

        public static RawString to_rawstring​(byte[] data)
      • to_timestamp

        public Timestamp to_timestamp()
      • to_boolean

        public boolean to_boolean()
      • to_double

        public double to_double()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • putLong

        public static void putLong​(byte[] array,
                                   int index,
                                   long value)
      • putInt

        public static void putInt​(byte[] array,
                                  int index,
                                  int value)
      • putBoolean

        public static void putBoolean​(byte[] bytes,
                                      int offset,
                                      boolean val)
      • putDouble

        public static void putDouble​(byte[] bytes,
                                     int offset,
                                     double val)
      • toLong

        public static long toLong​(byte[] array,
                                  int index)
      • compareInt

        public static int compareInt​(byte[] array,
                                     int index,
                                     int value)
      • compareInt

        public static int compareInt​(byte[] array,
                                     int index,
                                     long value)
      • compareLong

        public static int compareLong​(byte[] array,
                                      int index,
                                      int value)
      • compareLong

        public static int compareLong​(byte[] array,
                                      int index,
                                      long value)
      • toInt

        public static int toInt​(byte[] array,
                                int index)
      • toTimestamp

        public static Timestamp toTimestamp​(byte[] bytes,
                                            int offset)
      • toBoolean

        public static boolean toBoolean​(byte[] bytes,
                                        int offset)
      • toDouble

        public static double toDouble​(byte[] bytes,
                                      int offset)
      • compare

        public static int compare​(byte[] left,
                                  byte[] right)
      • startsWith

        public static boolean startsWith​(byte[] left,
                                         int offset,
                                         int bufferlen,
                                         int max,
                                         byte[] right)
      • getLength

        public int getLength()
      • getBuffer

        public byte[] getBuffer()
      • getOffset

        public int getOffset()
      • arraytohexstring

        public static String arraytohexstring​(byte[] buffer,
                                              int offset,
                                              int length)
      • next

        public Bytes next()
        Returns the next Bytes instance.

        Depending on current instance it couldn't be possible to evaluate the next one: if every bit in current byte array is already 1 next would generate an overflow and isn't permitted.

        Returns:
        the next Bytes instance
        Throws:
        IllegalStateException - if cannot evaluate a next value.
      • startsWith

        public boolean startsWith​(int length,
                                  byte[] prefix)
      • nonShared

        public Bytes nonShared()
        Ensure that this value is not retaining strong references to a shared buffer
        Returns:
        the buffer itself or a copy
      • isShared

        public boolean isShared()