public class HandshakeEncoder extends Object implements IEncoder<HandshakeFrame,ByteBuffer>, IEventDrivenCodec
Constructor and Description |
---|
HandshakeEncoder(boolean clientMode)
Constructs a Web Socket handshake encoder.
|
Modifier and Type | Method and Description |
---|---|
void |
added(ISession session,
ICodecPipeline pipeline)
Signals that the codec has been added to the pipeline associated with a
session.
|
void |
encode(ISession session,
HandshakeFrame data,
List<ByteBuffer> out)
Encodes data from one type to another one.
|
void |
event(ISession session,
SessionEvent event)
Signals a session event to the codec.
|
Class<HandshakeFrame> |
getInboundType()
Returns the type of the accepted inbound objects.
|
Class<ByteBuffer> |
getOutboundType()
Returns the type of the produced outbound objects.
|
void |
removed(ISession session,
ICodecPipeline pipeline)
Signals that the codec has been removed from the pipeline associated with a
session.
|
public HandshakeEncoder(boolean clientMode)
clientMode
- determines the mode (client/server) in which the encoder
should workpublic Class<HandshakeFrame> getInboundType()
ICodec
getInboundType
in interface ICodec<HandshakeFrame,ByteBuffer>
public Class<ByteBuffer> getOutboundType()
ICodec
getOutboundType
in interface ICodec<HandshakeFrame,ByteBuffer>
public void encode(ISession session, HandshakeFrame data, List<ByteBuffer> out) throws Exception
IEncoder
Encoders that do not produce an output (i.e. the O parameter is
Void
) cannot change the object passed as the data
argument. They should not also store it for future use as its state can
be changed.
The above limitations regarding the data
argument do not apply to
encoders that produce an output.
encode
in interface IEncoder<HandshakeFrame,ByteBuffer>
session
- the ISession
which the passed data belongs todata
- the data to decode to another oneout
- the List
to which the decoded data should be added, or
null
if O is Void
Exception
- is thrown, if an error occurpublic void added(ISession session, ICodecPipeline pipeline)
IEventDrivenCodec
added
in interface IEventDrivenCodec
session
- the session the pipeline is associated withpipeline
- the pipeline the codec has been added topublic void event(ISession session, SessionEvent event)
IEventDrivenCodec
event
in interface IEventDrivenCodec
session
- the session which state is changingevent
- the session eventpublic void removed(ISession session, ICodecPipeline pipeline)
IEventDrivenCodec
removed
in interface IEventDrivenCodec
session
- the session the pipeline is associated withpipeline
- the pipeline the codec has been removed fromCopyright © 2017–2022 SNF4J.ORG. All rights reserved.