Class Util


  • public final class Util
    extends java.lang.Object
    The Util class provides utility functions for converting portions of byte arrays to values and putting values into byte arrays.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Util()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long fieldToValue​(byte[] buffer, int offset, int length)
      Converts a field in a byte array into a value.
      static void valueToFieldOffest​(byte[] buffer, int offset, int length, long l)
      Puts a value into a specific location in a byte buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Util

        private Util()
    • Method Detail

      • fieldToValue

        public static long fieldToValue​(byte[] buffer,
                                        int offset,
                                        int length)
        Converts a field in a byte array into a value.
        Parameters:
        buffer - The byte array that contains the value
        offset - The offset of where the value begins in the byte array
        length - The length of the field to be converted
        Returns:
        A long that represent the value of the field
      • valueToFieldOffest

        public static void valueToFieldOffest​(byte[] buffer,
                                              int offset,
                                              int length,
                                              long l)
        Puts a value into a specific location in a byte buffer.
        Parameters:
        buffer - The buffer that the value will be written to.
        offset - The offset for where the value begins in the buffer.
        length - The length of the field in the array
        l - The value to be encoded into the byte array