public class SpdyFrameCodec extends FrameDecoder implements SpdyFrameDecoderDelegate, ChannelDownstreamHandler
ChannelHandler
that encodes and decodes SPDY Frames.ChannelHandler.Sharable
cumulation, DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS
限定符 | 构造器和说明 |
---|---|
|
SpdyFrameCodec(SpdyVersion version)
Creates a new instance with the specified
version and
the default decoder and encoder options
(maxChunkSize (8192) , maxHeaderSize (16384) ,
compressionLevel (6) , windowBits (15) ,
and memLevel (8) ). |
|
SpdyFrameCodec(SpdyVersion version,
int maxChunkSize,
int maxHeaderSize,
int compressionLevel,
int windowBits,
int memLevel)
Creates a new instance with the specified decoder and encoder options.
|
protected |
SpdyFrameCodec(SpdyVersion version,
int maxChunkSize,
org.jboss.netty.handler.codec.spdy.SpdyHeaderBlockDecoder spdyHeaderBlockDecoder,
org.jboss.netty.handler.codec.spdy.SpdyHeaderBlockEncoder spdyHeaderBlockEncoder) |
限定符和类型 | 方法和说明 |
---|---|
void |
beforeAdd(ChannelHandlerContext ctx) |
protected void |
cleanup(ChannelHandlerContext ctx,
ChannelStateEvent e)
|
protected java.lang.Object |
decode(ChannelHandlerContext ctx,
Channel channel,
ChannelBuffer buffer)
Decodes the received packets so far into a frame.
|
void |
handleDownstream(ChannelHandlerContext ctx,
ChannelEvent evt)
Handles the specified downstream event.
|
void |
readDataFrame(int streamId,
boolean last,
ChannelBuffer data)
Called when a DATA frame is received.
|
void |
readFrameError(java.lang.String message)
Called when an unrecoverable session error has occurred.
|
void |
readGoAwayFrame(int lastGoodStreamId,
int statusCode)
Called when a GOAWAY frame is received.
|
void |
readHeaderBlock(ChannelBuffer headerBlock)
Called when the header block within a SYN_STREAM, SYN_REPLY, or HEADERS frame is received.
|
void |
readHeaderBlockEnd()
Called when an entire header block has been received.
|
void |
readHeadersFrame(int streamId,
boolean last)
Called when a HEADERS frame is received.
|
void |
readPingFrame(int id)
Called when a PING frame is received.
|
void |
readRstStreamFrame(int streamId,
int statusCode)
Called when a RST_STREAM frame is received.
|
void |
readSetting(int id,
int value,
boolean persistValue,
boolean persisted)
Called when an individual setting within a SETTINGS frame is received.
|
void |
readSettingsEnd()
Called when the entire SETTINGS frame has been received.
|
void |
readSettingsFrame(boolean clearPersisted)
Called when a SETTINGS frame is received.
|
void |
readSynReplyFrame(int streamId,
boolean last)
Called when a SYN_REPLY frame is received.
|
void |
readSynStreamFrame(int streamId,
int associatedToStreamId,
byte priority,
boolean last,
boolean unidirectional)
Called when a SYN_STREAM frame is received.
|
void |
readWindowUpdateFrame(int streamId,
int deltaWindowSize)
Called when a WINDOW_UPDATE frame is received.
|
actualReadableBytes, afterAdd, afterRemove, appendToCumulation, beforeRemove, channelClosed, channelDisconnected, decodeLast, exceptionCaught, extractFrame, getMaxCumulationBufferCapacity, getMaxCumulationBufferComponents, internalBuffer, isUnfold, messageReceived, newCumulationBuffer, replace, setMaxCumulationBufferCapacity, setMaxCumulationBufferComponents, setUnfold, unfoldAndFireMessageReceived, updateCumulation
channelBound, channelConnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete
public SpdyFrameCodec(SpdyVersion version)
version
and
the default decoder and encoder options
(maxChunkSize (8192)
, maxHeaderSize (16384)
,
compressionLevel (6)
, windowBits (15)
,
and memLevel (8)
).public SpdyFrameCodec(SpdyVersion version, int maxChunkSize, int maxHeaderSize, int compressionLevel, int windowBits, int memLevel)
protected SpdyFrameCodec(SpdyVersion version, int maxChunkSize, org.jboss.netty.handler.codec.spdy.SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, org.jboss.netty.handler.codec.spdy.SpdyHeaderBlockEncoder spdyHeaderBlockEncoder)
public void beforeAdd(ChannelHandlerContext ctx) throws java.lang.Exception
beforeAdd
在接口中 LifeCycleAwareChannelHandler
beforeAdd
在类中 FrameDecoder
java.lang.Exception
protected java.lang.Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws java.lang.Exception
FrameDecoder
FrameDecoder.extractFrame(ChannelBuffer, int, int)
method,
to make optimizations easier later.decode
在类中 FrameDecoder
ctx
- the context of this handlerchannel
- the current channelbuffer
- the cumulative buffer of received packets so far.
Note that the buffer might be empty, which means you
should not make an assumption that the buffer contains
at least one byte in your decoder implementation.null
if there's not enough data in the buffer to decode a frame.java.lang.Exception
protected void cleanup(ChannelHandlerContext ctx, ChannelStateEvent e) throws java.lang.Exception
FrameDecoder
FrameDecoder.channelDisconnected(ChannelHandlerContext, ChannelStateEvent)
and
FrameDecoder.channelClosed(ChannelHandlerContext, ChannelStateEvent)
cleanup
在类中 FrameDecoder
java.lang.Exception
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt) throws java.lang.Exception
ChannelDownstreamHandler
handleDownstream
在接口中 ChannelDownstreamHandler
ctx
- the context object for this handlerevt
- the downstream event to process or interceptjava.lang.Exception
public void readDataFrame(int streamId, boolean last, ChannelBuffer data)
SpdyFrameDecoderDelegate
readDataFrame
在接口中 SpdyFrameDecoderDelegate
public void readSynStreamFrame(int streamId, int associatedToStreamId, byte priority, boolean last, boolean unidirectional)
SpdyFrameDecoderDelegate
readSynStreamFrame
在接口中 SpdyFrameDecoderDelegate
public void readSynReplyFrame(int streamId, boolean last)
SpdyFrameDecoderDelegate
readSynReplyFrame
在接口中 SpdyFrameDecoderDelegate
public void readRstStreamFrame(int streamId, int statusCode)
SpdyFrameDecoderDelegate
readRstStreamFrame
在接口中 SpdyFrameDecoderDelegate
public void readSettingsFrame(boolean clearPersisted)
SpdyFrameDecoderDelegate
readSettingsFrame
在接口中 SpdyFrameDecoderDelegate
public void readSetting(int id, int value, boolean persistValue, boolean persisted)
SpdyFrameDecoderDelegate
readSetting
在接口中 SpdyFrameDecoderDelegate
public void readSettingsEnd()
SpdyFrameDecoderDelegate
readSettingsEnd
在接口中 SpdyFrameDecoderDelegate
public void readPingFrame(int id)
SpdyFrameDecoderDelegate
readPingFrame
在接口中 SpdyFrameDecoderDelegate
public void readGoAwayFrame(int lastGoodStreamId, int statusCode)
SpdyFrameDecoderDelegate
readGoAwayFrame
在接口中 SpdyFrameDecoderDelegate
public void readHeadersFrame(int streamId, boolean last)
SpdyFrameDecoderDelegate
readHeadersFrame
在接口中 SpdyFrameDecoderDelegate
public void readWindowUpdateFrame(int streamId, int deltaWindowSize)
SpdyFrameDecoderDelegate
public void readHeaderBlock(ChannelBuffer headerBlock)
SpdyFrameDecoderDelegate
readHeaderBlock
在接口中 SpdyFrameDecoderDelegate
public void readHeaderBlockEnd()
SpdyFrameDecoderDelegate
readHeaderBlockEnd
在接口中 SpdyFrameDecoderDelegate
public void readFrameError(java.lang.String message)
SpdyFrameDecoderDelegate
readFrameError
在接口中 SpdyFrameDecoderDelegate