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

## org.apache.mina.filter.codec.textline
Class TextLineDecoder

    java.lang.Object
      org.apache.mina.filter.codec.textline.TextLineDecoder

All Implemented Interfaces:
  ProtocolDecoder

    public class TextLineDecoder

extends Object
implements ProtocolDecoder

A `ProtocolDecoder` which decodes a text line into a string.

Version:
  $Rev: 636237 $, $Date: 2008-03-12 16:35:18 +0900 (Wed, 12 Mar 2008) $,
Author:
  The Apache Directory Project (mina-dev@directory.apache.org)

Constructor Summary
`TextLineDecoder()` Creates a new instance with the current default `Charset` and `LineDelimiter.AUTO` delimiter.
`TextLineDecoder(Charset charset)` Creates a new instance with the spcified `charset` and `LineDelimiter.AUTO` delimiter.
`TextLineDecoder(Charset charset, LineDelimiter delimiter)` Creates a new instance with the specified `charset` and the specified `delimiter`.

Method Summary
`void` | `decode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out)` Decodes binary or protocol-specific content into higher-level message objects.
`void` | `dispose(IoSession session)` Releases all resources related with this decoder.
`void` | `finishDecode(IoSession session, ProtocolDecoderOutput out)` Invoked when the specified `session` is closed.
`int` | `getMaxLineLength()` Returns the allowed maximum size of the line to be decoded.
`void` | `setMaxLineLength(int maxLineLength)` Sets the allowed maximum size of the line to be decoded.

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

Constructor Detail

### TextLineDecoder

    public TextLineDecoder()

  Creates a new instance with the current default `Charset` and `LineDelimiter.AUTO` delimiter.

### TextLineDecoder

    public TextLineDecoder(Charset charset)

  Creates a new instance with the spcified `charset` and `LineDelimiter.AUTO` delimiter.

### TextLineDecoder

    public TextLineDecoder(Charset charset,
                           LineDelimiter delimiter)

  Creates a new instance with the specified `charset` and the specified `delimiter`.

Method Detail

### getMaxLineLength

    public int getMaxLineLength()

  Returns the allowed maximum size of the line to be decoded. If the size of the line to be decoded exceeds this value, the decoder will throw a `BufferDataException`. The default value is `1024` (1KB).

### setMaxLineLength

    public void setMaxLineLength(int maxLineLength)

  Sets the allowed maximum size of the line to be decoded. If the size of the line to be decoded exceeds this value, the decoder will throw a `BufferDataException`. The default value is `1024` (1KB).

### decode

    public void decode(IoSession session,
                       ByteBuffer in,
                       ProtocolDecoderOutput out)
                throws Exception

  Description copied from interface: `ProtocolDecoder`
  Decodes binary or protocol-specific content into higher-level message objects. MINA invokes `ProtocolDecoder.decode(IoSession, ByteBuffer, ProtocolDecoderOutput)` method with read data, and then the decoder implementation puts decoded messages into `ProtocolDecoderOutput`.

  Specified by:
    `decode` in interface `ProtocolDecoder`
  Throws:
    `Exception` - if the read data violated protocol specification

### finishDecode

    public void finishDecode(IoSession session,
                             ProtocolDecoderOutput out)
                      throws Exception

  Description copied from interface: `ProtocolDecoder`
  Invoked when the specified `session` is closed. This method is useful when you deal with the protocol which doesn't specify the length of a message such as HTTP response without `content-length` header. Implement this method to process the remaining data that `ProtocolDecoder.decode(IoSession, ByteBuffer, ProtocolDecoderOutput)` method didn't process completely.

  Specified by:
    `finishDecode` in interface `ProtocolDecoder`
  Throws:
    `Exception` - if the read data violated protocol specification

### dispose

    public void dispose(IoSession session)
                 throws Exception

  Description copied from interface: `ProtocolDecoder`
  Releases all resources related with this decoder.

  Specified by:
    `dispose` in interface `ProtocolDecoder`
  Throws:
    `Exception` - if failed to dispose all resources

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 © 2004-2008 Apache MINA Project. All Rights Reserved.