Top Description Fields Constructors Methods
io.netty.handler.codec.http.websocketx

public Class WebSocket00FrameDecoder

extends ReplayingDecoder<Void>
implements WebSocketFrameDecoder
Class Inheritance
All Implemented Interfaces
io.netty.handler.codec.http.websocketx.WebSocketFrameDecoder, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelHandler
Imports
io.netty.buffer.ByteBuf, io.netty.channel.ChannelHandlerContext, io.netty.handler.codec.ReplayingDecoder, .TooLongFrameException, io.netty.util.internal.ObjectUtil, java.util.List

Decodes ByteBufs into WebSocketFrames.

For the detailed instruction on adding add Web Socket support to your HTTP server, take a look into the WebSocketServer example located in the io.netty.example.http.websocket package.

Field Summary

Modifier and TypeField and Description
pack-priv static final int
private final long
private boolean

Constructor Summary

AccessConstructor and Description
public
public
WebSocket00FrameDecoder(int
the maximum frame size to decode
maxFrameSize
)

Creates a new instance of WebSocketFrameDecoder with the specified maxFrameSize.

public
WebSocket00FrameDecoder(WebSocketDecoderConfig
Frames decoder configuration.
decoderConfig
)

Creates a new instance of WebSocketFrameDecoder with the specified maxFrameSize.

Method Summary

Modifier and TypeMethod and Description
protected void
decode(ChannelHandlerContext ctx, ByteBuf
the ByteBuf from which to read data
in
,
List<Object>
the List to which decoded messages should be added
out
)

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other.
private WebSocketFrame
private WebSocketFrame
Inherited from io.netty.handler.codec.ReplayingDecoder:
callDecodecheckpointcheckpointstatestate

Field Detail

DEFAULT_MAX_FRAME_SIZEback to summary
pack-priv static final int DEFAULT_MAX_FRAME_SIZE
maxFrameSizeback to summary
private final long maxFrameSize
receivedClosingHandshakeback to summary
private boolean receivedClosingHandshake

Constructor Detail

WebSocket00FrameDecoderback to summary
public WebSocket00FrameDecoder()
WebSocket00FrameDecoderback to summary
public WebSocket00FrameDecoder(int maxFrameSize)

Creates a new instance of WebSocketFrameDecoder with the specified maxFrameSize. If the client sends a frame size larger than maxFrameSize, the channel will be closed.

Parameters
maxFrameSize:int

the maximum frame size to decode

WebSocket00FrameDecoderback to summary
public WebSocket00FrameDecoder(WebSocketDecoderConfig decoderConfig)

Creates a new instance of WebSocketFrameDecoder with the specified maxFrameSize. If the client sends a frame size larger than maxFrameSize, the channel will be closed.

Parameters
decoderConfig:WebSocketDecoderConfig

Frames decoder configuration.

Method Detail

decodeback to summary
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Doc from io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other. This method will be called till either the input ByteBuf has nothing to read when return from this method or till nothing was read from the input ByteBuf.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this ByteToMessageDecoder belongs to

in:ByteBuf

the ByteBuf from which to read data

out:List<Object>

the List to which decoded messages should be added

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
decodeBinaryFrameback to summary
private WebSocketFrame decodeBinaryFrame(ChannelHandlerContext ctx, byte type, ByteBuf buffer)
decodeTextFrameback to summary
private WebSocketFrame decodeTextFrame(ChannelHandlerContext ctx, ByteBuf buffer)