Package rocks.xmpp.websocket.codec
Class XmppWebSocketEncoder
- java.lang.Object
-
- rocks.xmpp.websocket.codec.XmppWebSocketEncoder
-
- All Implemented Interfaces:
javax.websocket.Encoder
,javax.websocket.Encoder.TextStream<StreamElement>
public final class XmppWebSocketEncoder extends Object implements javax.websocket.Encoder.TextStream<StreamElement>
Encodes XMPPStreamElement
s to WebSocket text messages.The required
Marshaller
for encoding must be supplied viaEndpointConfig.getUserProperties()
, seeXmppWebSocketEncoder.UserProperties.MARSHALLER
.Optionally you can also provide a callback, which is called after marshalling with the encoded text message (the XML string) and the stream element. This is useful for debugging purposes, see
XmppWebSocketEncoder.UserProperties.ON_WRITE
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XmppWebSocketEncoder.UserProperties
User properties for usage inEndpointConfig.getUserProperties()
.
-
Constructor Summary
Constructors Constructor Description XmppWebSocketEncoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
encode(StreamElement object, Writer writer)
void
init(javax.websocket.EndpointConfig config)
-
-
-
Method Detail
-
encode
public final void encode(StreamElement object, Writer writer) throws javax.websocket.EncodeException, IOException
- Specified by:
encode
in interfacejavax.websocket.Encoder.TextStream<StreamElement>
- Throws:
javax.websocket.EncodeException
IOException
-
init
public final void init(javax.websocket.EndpointConfig config)
- Specified by:
init
in interfacejavax.websocket.Encoder
-
destroy
public final void destroy()
- Specified by:
destroy
in interfacejavax.websocket.Encoder
-
-