org.jboss.netty.handler.codec.frame
类 DelimiterBasedFrameDecoder

java.lang.Object
  继承者 org.jboss.netty.channel.SimpleChannelUpstreamHandler
      继承者 org.jboss.netty.handler.codec.frame.FrameDecoder
          继承者 org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder
所有已实现的接口:
ChannelHandler, ChannelUpstreamHandler

public class DelimiterBasedFrameDecoder
extends FrameDecoder

A decoder that splits the received ChannelBuffers by one or more delimiters. It is particularly useful for decoding the frames which ends with a delimiter such as NUL or newline characters.

Predefined delimiters

Delimiters defines frequently used delimiters for convenience' sake.

Specifying more than one delimiter

DelimiterBasedFrameDecoder allows you to specify more than one delimiter. If more than one delimiter is found in the buffer, it chooses the delimiter which produces the shortest frame. For example, if you have the following data in the buffer:

 +--------------+
 | ABC\nDEF\r\n |
 +--------------+
 
a DelimiterBasedFrameDecoder(Delimiters.lineDelimiter()) will choose '\n' as the first delimiter and produce two frames:
 +-----+-----+
 | ABC | DEF |
 +-----+-----+
 
rather than incorrectly choosing '\r\n' as the first delimiter:
 +----------+
 | ABC\nDEF |
 +----------+
 


嵌套类摘要
 
从接口 org.jboss.netty.channel.ChannelHandler 继承的嵌套类/接口
ChannelHandler.Sharable
 
构造方法摘要
DelimiterBasedFrameDecoder(int maxFrameLength, boolean stripDelimiter, ChannelBuffer... delimiters)
          Creates a new instance.
DelimiterBasedFrameDecoder(int maxFrameLength, boolean stripDelimiter, ChannelBuffer delimiter)
          Creates a new instance.
DelimiterBasedFrameDecoder(int maxFrameLength, ChannelBuffer... delimiters)
          Creates a new instance.
DelimiterBasedFrameDecoder(int maxFrameLength, ChannelBuffer delimiter)
          Creates a new instance.
 
方法摘要
 
从类 org.jboss.netty.handler.codec.frame.FrameDecoder 继承的方法
channelClosed, channelDisconnected, exceptionCaught, messageReceived
 
从类 org.jboss.netty.channel.SimpleChannelUpstreamHandler 继承的方法
channelBound, channelConnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

DelimiterBasedFrameDecoder

public DelimiterBasedFrameDecoder(int maxFrameLength,
                                  ChannelBuffer delimiter)
Creates a new instance.

参数:
maxFrameLength - the maximum length of the decoded frame. A TooLongFrameException is thrown if the length of the frame exceeds this value.
delimiter - the delimiter

DelimiterBasedFrameDecoder

public DelimiterBasedFrameDecoder(int maxFrameLength,
                                  boolean stripDelimiter,
                                  ChannelBuffer delimiter)
Creates a new instance.

参数:
maxFrameLength - the maximum length of the decoded frame. A TooLongFrameException is thrown if the length of the frame exceeds this value.
stripDelimiter - whether the decoded frame should strip out the delimiter or not
delimiter - the delimiter

DelimiterBasedFrameDecoder

public DelimiterBasedFrameDecoder(int maxFrameLength,
                                  ChannelBuffer... delimiters)
Creates a new instance.

参数:
maxFrameLength - the maximum length of the decoded frame. A TooLongFrameException is thrown if the length of the frame exceeds this value.
delimiters - the delimiters

DelimiterBasedFrameDecoder

public DelimiterBasedFrameDecoder(int maxFrameLength,
                                  boolean stripDelimiter,
                                  ChannelBuffer... delimiters)
Creates a new instance.

参数:
maxFrameLength - the maximum length of the decoded frame. A TooLongFrameException is thrown if the length of the frame exceeds this value.
stripDelimiter - whether the decoded frame should strip out the delimiter or not
delimiters - the delimiters