Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ch.mimo.netty.handler.codec.icap
Class IcapDecoderUtil

    java.lang.Object
      ch.mimo.netty.handler.codec.icap.IcapDecoderUtil

    public final class IcapDecoderUtil

extends Object

Utility that provides decoding support for ICAP messages.

Author:
  Michael Mimo Moratti (mimo@mimo.ch)

Method Summary
`static int` | `findEndOfString(String sb)` finds the end of a string.
`static int` | `findNonWhitespace(String sb, int offset)` finds the first occurrence of a non whitespace character.
`static int` | `findWhitespace(String sb, int offset)` finds the first occurrence of a whitespace character
`static int` | `getChunkSize(String line)` parses the chunk size from a line.
`static boolean` | `isHeaderLineSimpleValue(String header)`
`static String` | `previewLine(org.jboss.netty.buffer.ChannelBuffer buffer, int maxLineLength)` previews a line until CR / LF / CRLF this will not increas the buffers readerIndex!
`static List<String[]>` | `readHeaders(org.jboss.netty.buffer.ChannelBuffer buffer, int maxSize)` parses all available message headers.
`static String` | `readLine(org.jboss.netty.buffer.ChannelBuffer buffer, int maxLineLength)` reads a line until CR / LF / CRLF
`static String` | `readSingleHeaderLine(org.jboss.netty.buffer.ChannelBuffer buffer, SizeDelimiter sizeDelimiter)` reads one individual header "key: value"
`static void` | `skipControlCharacters(org.jboss.netty.buffer.ChannelBuffer buffer)` finds the true beginning of the request by skipping all prepended control and whitespace characters.
`static String[]` | `splitHeader(String sb)` Splits one header into key|value
`static String[]` | `splitInitialLine(String sb)` Splits an initial line.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### skipControlCharacters

    public static void skipControlCharacters(org.jboss.netty.buffer.ChannelBuffer buffer)

  finds the true beginning of the request by skipping all prepended control and whitespace characters.

  Parameters:
    `buffer` -

### readLine

    public static String readLine(org.jboss.netty.buffer.ChannelBuffer buffer,
                                  int maxLineLength)
                           throws DecodingException

  reads a line until CR / LF / CRLF

  Parameters:
    `buffer` -
    `maxLineLength` -
  Returns:
    the first line found in the buffer.
  Throws:
    `org.jboss.netty.handler.codec.frame.TooLongFrameException`
    `DecodingException`

### previewLine

    public static String previewLine(org.jboss.netty.buffer.ChannelBuffer buffer,
                                     int maxLineLength)
                              throws DecodingException

  previews a line until CR / LF / CRLF this will not increas the buffers readerIndex!

  Parameters:
    `buffer` -
    `maxLineLength` -
  Returns:
    the first line found in the buffer
  Throws:
    `DecodingException`

### splitInitialLine

    public static String[] splitInitialLine(String sb)

  Splits an initial line.

  Parameters:
    `sb` -
  Returns:
    string array containing all elements found in the initial line.

### findNonWhitespace

    public static int findNonWhitespace(String sb,
                                        int offset)

  finds the first occurrence of a non whitespace character.

  Parameters:
    `sb` - string to find non-whitespaces in
    `offset` - the offset to start searching from.
  Returns:
    the position of the first non-whitespace

### findWhitespace

    public static int findWhitespace(String sb,
                                     int offset)

  finds the first occurrence of a whitespace character

  Parameters:
    `sb` - string to find whitespaces in.
    `offset` - to search from within the string.
  Returns:
    the position of the first whitespace.

### findEndOfString

    public static int findEndOfString(String sb)

  finds the end of a string.

  Parameters:
    `sb` - string to find the end from
  Returns:
    the end position.

### getChunkSize

    public static int getChunkSize(String line)
                            throws DecodingException

  parses the chunk size from a line.

  Parameters:
    `line` -
  Returns:
    -1 if the chunk size indicates that a preview message is early terminated.
  Throws:
    `DecodingException`

### readHeaders

    public static List<String[]> readHeaders(org.jboss.netty.buffer.ChannelBuffer buffer,
                                             int maxSize)
                                      throws DecodingException

  parses all available message headers.

  Parameters:
    `buffer` - @see `ChannelBuffer` that contains the headers.
    `maxSize` - the maximum size of all headers concatenated.
  Returns:
    a list of String arrays containing [0] key [1] value of each header.
  Throws:
    `org.jboss.netty.handler.codec.frame.TooLongFrameException` - if the maximum size is reached.
    `DecodingException`

### isHeaderLineSimpleValue

    public static boolean isHeaderLineSimpleValue(String header)

### readSingleHeaderLine

    public static String readSingleHeaderLine(org.jboss.netty.buffer.ChannelBuffer buffer,
                                              SizeDelimiter sizeDelimiter)
                                       throws DecodingException

  reads one individual header "key: value"

  Parameters:
    `buffer` - which contains the request stream
    `sizeDelimiter` - the current header size, accumulated for all headers.
  Returns:
    one complete header containing key and value.
  Throws:
    `org.jboss.netty.handler.codec.frame.TooLongFrameException` - In case the total header length is exceeded.
    `DecodingException`

### splitHeader

    public static String[] splitHeader(String sb)

  Splits one header into key|value

  Parameters:
    `sb` -
  Returns:
    string array containing the key [0] and value [1] separated.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.