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

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

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    & byte.
    static final byte
    : byte.
    static final byte
    \r (carriage return) byte.
    static final byte
    = byte.
    static final byte
    # byte.
    static final byte
    \n (new line) byte.
    static final byte
    % byte.
    static final byte
    ? byte.
    static final byte
    ; byte.
    static final byte
    / byte.
    static final byte
    (space) byte.
    static final byte
    Horizontal tabulator byte.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    static long
    toWord(byte[] buffer, int offset)
    Converts the first 8 bytes from offset to a long, using appropriate byte order for this machine.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 appropriate byte order for this machine.
      • 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