java.lang.Object
io.helidon.common.buffers.Bytes

public final class Bytes extends Object
Bytes commonly used in HTTP.
  • Field Details

  • Method Details

    • firstIndexOf

      public static int firstIndexOf(byte[] buffer, int fromIndex, int toIndex, byte value)
      This is using a SWAR (SIMD Within A Register) batch read technique to minimize bound-checks and improve memory usage while searching for value.

      This method does NOT do a bound check on the buffer length and the fromIndex and toIndex, neither does it check if the toIndex is bigger than the fromIndex.

      Parameters:
      buffer - the byte buffer to search
      fromIndex - first index in the array
      toIndex - last index in the array
      value - to search for
      Returns:
      first index of the desired byte value, or -1 if not found
    • toWord

      public static long toWord(byte[] buffer, int offset)
      Converts the first 8 bytes from offset to a long, using little endian byte order.
      • This method DOES NOT do a bound check
      • This method DOES NOT validate there are 8 bytes available
      Parameters:
      buffer - bytes to convert
      offset - offset within the byte array
      Returns:
      long word from the first 8 bytes from offset