Class HttpPostBodyUtil


  • final class HttpPostBodyUtil
    extends java.lang.Object
    Shared Static object between HttpMessageDecoder, HttpPostRequestDecoder and HttpPostRequestEncoder
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  HttpPostBodyUtil.SeekAheadOptimize
      This class intends to decrease the CPU in seeking ahead some bytes in HttpPostRequestDecoder
      static class  HttpPostBodyUtil.TransferEncodingMechanism
      Allowed mechanism for multipart mechanism := "7bit" / "8bit" / "binary" Not allowed: "quoted-printable" / "base64"
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private HttpPostBodyUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static int findDelimiter​(ByteBuf buffer, int index, byte[] delimiter, boolean precededByLineBreak)
      Try to find the delimiter, with LF or CRLF in front of it (added as delimiters) if needed
      (package private) static int findEndOfString​(java.lang.String sb)
      Find the end of String
      (package private) static int findLastLineBreak​(ByteBuf buffer, int index)
      Try to find last LF or CRLF as Line Breaking
      (package private) static int findLineBreak​(ByteBuf buffer, int index)
      Try to find first LF or CRLF as Line Breaking
      (package private) static int findNonWhitespace​(java.lang.String sb, int offset)
      Find the first non whitespace
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_BINARY_CONTENT_TYPE

        public static final java.lang.String DEFAULT_BINARY_CONTENT_TYPE
        Default Content-Type in binary form
        See Also:
        Constant Field Values
      • DEFAULT_TEXT_CONTENT_TYPE

        public static final java.lang.String DEFAULT_TEXT_CONTENT_TYPE
        Default Content-Type in Text form
        See Also:
        Constant Field Values
    • Constructor Detail

      • HttpPostBodyUtil

        private HttpPostBodyUtil()
    • Method Detail

      • findNonWhitespace

        static int findNonWhitespace​(java.lang.String sb,
                                     int offset)
        Find the first non whitespace
        Returns:
        the rank of the first non whitespace
      • findEndOfString

        static int findEndOfString​(java.lang.String sb)
        Find the end of String
        Returns:
        the rank of the end of string
      • findLineBreak

        static int findLineBreak​(ByteBuf buffer,
                                 int index)
        Try to find first LF or CRLF as Line Breaking
        Parameters:
        buffer - the buffer to search in
        index - the index to start from in the buffer
        Returns:
        a relative position from index > 0 if LF or CRLF is found or < 0 if not found
      • findLastLineBreak

        static int findLastLineBreak​(ByteBuf buffer,
                                     int index)
        Try to find last LF or CRLF as Line Breaking
        Parameters:
        buffer - the buffer to search in
        index - the index to start from in the buffer
        Returns:
        a relative position from index > 0 if LF or CRLF is found or < 0 if not found
      • findDelimiter

        static int findDelimiter​(ByteBuf buffer,
                                 int index,
                                 byte[] delimiter,
                                 boolean precededByLineBreak)
        Try to find the delimiter, with LF or CRLF in front of it (added as delimiters) if needed
        Parameters:
        buffer - the buffer to search in
        index - the index to start from in the buffer
        delimiter - the delimiter as byte array
        precededByLineBreak - true if it must be preceded by LF or CRLF, else false
        Returns:
        a relative position from index > 0 if delimiter found designing the start of it (including LF or CRLF is asked) or a number < 0 if delimiter is not found
        Throws:
        java.lang.IndexOutOfBoundsException - if offset + delimiter.length is greater than buffer.capacity