Class HttpCodecUtils

java.lang.Object
org.glassfish.grizzly.http.util.HttpCodecUtils

public class HttpCodecUtils extends Object
General HttpCodec utility methods.
Author:
Alexey Stashok
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    checkEOL(HttpCodecFilter.HeaderParsingState parsingState, byte[] input, int end)
     
    static int
    checkEOL(HttpCodecFilter.HeaderParsingState parsingState, org.glassfish.grizzly.Buffer input)
     
    static boolean
    findEOL(HttpCodecFilter.HeaderParsingState state, byte[] input, int end)
     
    static boolean
    findEOL(HttpCodecFilter.HeaderParsingState state, org.glassfish.grizzly.Buffer input)
     
    static int
    findSpace(byte[] input, int offset, int end, int packetLimit)
     
    static int
    findSpace(org.glassfish.grizzly.Buffer input, int offset, int packetLimit)
     
    static org.glassfish.grizzly.Buffer
    getLongAsBuffer(org.glassfish.grizzly.memory.MemoryManager memoryManager, long length)
     
    static int
    indexOf(org.glassfish.grizzly.Buffer input, int offset, byte b, int packetLimit)
     
    static boolean
    Returns true if the passed symbol code represents a non-printable US-ASCII symbol in range [Integer.MIN_VALUE; 9) U (9; 31] U [127; Integer.MAX_VALUE].
    static boolean
     
    static boolean
    isSpaceOrTab(byte b)
     
    static void
    parseHost(DataChunk hostDC, DataChunk serverNameDC, HttpRequestPacket request)
     
    static org.glassfish.grizzly.Buffer
    put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, byte value)
     
    static org.glassfish.grizzly.Buffer
    put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, byte[] array)
     
    static org.glassfish.grizzly.Buffer
    put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, byte[] array, int off, int len)
     
    static org.glassfish.grizzly.Buffer
    put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, byte[] tempBuffer, String s)
     
    static org.glassfish.grizzly.Buffer
    put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, byte[] tempBuffer, DataChunk chunk)
     
    static org.glassfish.grizzly.Buffer
    put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, org.glassfish.grizzly.Buffer buffer)
     
    static org.glassfish.grizzly.Buffer
    resizeBuffer(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer buffer, int grow)
     
    static int
    skipSpaces(byte[] input, int offset, int end, int packetLimit)
     
    static int
    skipSpaces(org.glassfish.grizzly.Buffer input, int offset, int packetLimit)
     
    static byte[]
    Converts the a CharSequence to a byte array, eliminating all the unprintable US-ASCII symbols by replacing them with spaces (' ').
    static byte[]
    toCheckedByteArray(CharSequence s, byte[] dstArray, int arrayOffs)
    Serializes the passed CharSequence into a passed byte array starting from a given offset.

    Methods inherited from class java.lang.Object

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

    • HttpCodecUtils

      public HttpCodecUtils()
  • Method Details

    • parseHost

      public static void parseHost(DataChunk hostDC, DataChunk serverNameDC, HttpRequestPacket request)
    • checkEOL

      public static int checkEOL(HttpCodecFilter.HeaderParsingState parsingState, org.glassfish.grizzly.Buffer input)
    • checkEOL

      public static int checkEOL(HttpCodecFilter.HeaderParsingState parsingState, byte[] input, int end)
    • findEOL

      public static boolean findEOL(HttpCodecFilter.HeaderParsingState state, org.glassfish.grizzly.Buffer input)
    • findEOL

      public static boolean findEOL(HttpCodecFilter.HeaderParsingState state, byte[] input, int end)
    • findSpace

      public static int findSpace(org.glassfish.grizzly.Buffer input, int offset, int packetLimit)
    • findSpace

      public static int findSpace(byte[] input, int offset, int end, int packetLimit)
    • skipSpaces

      public static int skipSpaces(org.glassfish.grizzly.Buffer input, int offset, int packetLimit)
    • skipSpaces

      public static int skipSpaces(byte[] input, int offset, int end, int packetLimit)
    • indexOf

      public static int indexOf(org.glassfish.grizzly.Buffer input, int offset, byte b, int packetLimit)
    • getLongAsBuffer

      public static org.glassfish.grizzly.Buffer getLongAsBuffer(org.glassfish.grizzly.memory.MemoryManager memoryManager, long length)
    • put

      public static org.glassfish.grizzly.Buffer put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, byte[] tempBuffer, DataChunk chunk)
    • put

      public static org.glassfish.grizzly.Buffer put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, byte[] tempBuffer, String s)
    • put

      public static org.glassfish.grizzly.Buffer put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, byte[] array)
    • put

      public static org.glassfish.grizzly.Buffer put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, byte[] array, int off, int len)
    • put

      public static org.glassfish.grizzly.Buffer put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, org.glassfish.grizzly.Buffer buffer)
    • put

      public static org.glassfish.grizzly.Buffer put(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer dstBuffer, byte value)
    • resizeBuffer

      public static org.glassfish.grizzly.Buffer resizeBuffer(org.glassfish.grizzly.memory.MemoryManager memoryManager, org.glassfish.grizzly.Buffer buffer, int grow)
    • isNotSpaceAndTab

      public static boolean isNotSpaceAndTab(byte b)
    • isSpaceOrTab

      public static boolean isSpaceOrTab(byte b)
    • toCheckedByteArray

      public static byte[] toCheckedByteArray(CharSequence s)
      Converts the a CharSequence to a byte array, eliminating all the unprintable US-ASCII symbols by replacing them with spaces (' ').
      Parameters:
      s - CharSequence
      Returns:
      a converted byte array, where all the char sequence's unprintable US-ASCII symbols have been replaced with spaces (' ')
    • toCheckedByteArray

      public static byte[] toCheckedByteArray(CharSequence s, byte[] dstArray, int arrayOffs)
      Serializes the passed CharSequence into a passed byte array starting from a given offset. All the unprintable US-ASCII symbols will be replaced with spaces (' ').
      Parameters:
      s - CharSequence
      dstArray - the byte array to be used to convert the CharSequence into
      arrayOffs - the offset in the byte array, where the serialization will be started
      Returns:
      the passed dstArray
      Throws:
      IllegalArgumentException - if there is no enough space in the dstArray to serialize the CharSequence
    • isNonPrintableUsAscii

      public static boolean isNonPrintableUsAscii(int ub)
      Returns true if the passed symbol code represents a non-printable US-ASCII symbol in range [Integer.MIN_VALUE; 9) U (9; 31] U [127; Integer.MAX_VALUE].
      Parameters:
      ub - the symbol code to check
      Returns:
      true if the passed symbol code represents a non-printable US-ASCII symbol in range [Integer.MIN_VALUE; 9) U (9; 31] U [127; Integer.MAX_VALUE]