Class InBandByteStreamManager
- java.lang.Object
-
- rocks.xmpp.core.session.Manager
-
- rocks.xmpp.extensions.bytestreams.ByteStreamManager
-
- rocks.xmpp.extensions.bytestreams.ibb.InBandByteStreamManager
-
- All Implemented Interfaces:
ExtensionProtocol,InboundMessageHandler,IQHandler,DiscoverableInfo
public final class InBandByteStreamManager extends ByteStreamManager implements IQHandler, InboundMessageHandler, ExtensionProtocol, DiscoverableInfo
A manager for XEP-0047: In-Band Bytestreams. IBB streams use the same transport as XMPP, i.e. the same TCP or BOSH connection.To initiate an IBB session with another entity, use
initiateSession(Jid, String, int).This class is thread-safe.
- See Also:
- XEP-0047: In-Band Bytestreams
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>getFeatures()Gets the features.StringgetNamespace()The protocol's main namespace.Class<?>getPayloadClass()Gets the IQ's payload class.InBandByteStream.Open.StanzaTypegetStanzaType()Gets the stanza type.voidhandleInboundMessage(MessageEvent e)Handles an inbound message.IQhandleRequest(IQ iq)AsyncResult<ByteStreamSession>initiateSession(Jid receiver, String sessionId)Initiates a byte stream session with another entity.AsyncResult<ByteStreamSession>initiateSession(Jid receiver, String sessionId, int blockSize)Initiates an in-band byte stream session.voidsetStanzaType(InBandByteStream.Open.StanzaType stanzaType)Sets the stanza type, which is used to send data chunks.-
Methods inherited from class rocks.xmpp.extensions.bytestreams.ByteStreamManager
addByteStreamListener, removeByteStreamListener
-
Methods inherited from class rocks.xmpp.core.session.Manager
isEnabled, setEnabled
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface rocks.xmpp.extensions.disco.model.info.DiscoverableInfo
getExtensions, getIdentities
-
Methods inherited from interface rocks.xmpp.core.ExtensionProtocol
isEnabled
-
-
-
-
Method Detail
-
initiateSession
public final AsyncResult<ByteStreamSession> initiateSession(Jid receiver, String sessionId, int blockSize)
Initiates an in-band byte stream session.- Parameters:
receiver- The receiver.sessionId- The session id.blockSize- The block size.- Returns:
- The async result with the in-band byte stream session.
-
initiateSession
public final AsyncResult<ByteStreamSession> initiateSession(Jid receiver, String sessionId)
Description copied from class:ByteStreamManagerInitiates a byte stream session with another entity.- Specified by:
initiateSessionin classByteStreamManager- Parameters:
receiver- The peer entity.sessionId- The session id.- Returns:
- The async result containing the session.
-
getStanzaType
public final InBandByteStream.Open.StanzaType getStanzaType()
Gets the stanza type.- Returns:
- The stanza type.
-
setStanzaType
public final void setStanzaType(InBandByteStream.Open.StanzaType stanzaType)
Sets the stanza type, which is used to send data chunks. It is recommended to leave this on the default (InBandByteStream.Open.StanzaType.IQ).- Parameters:
stanzaType- The stanza type.
-
getPayloadClass
public Class<?> getPayloadClass()
Description copied from interface:IQHandlerGets the IQ's payload class. Only payloads of this type are handled by this handler.- Specified by:
getPayloadClassin interfaceIQHandler- Returns:
- The IQ's payload class.
- See Also:
Stanza.getExtension(Class)
-
handleRequest
public IQ handleRequest(IQ iq)
Description copied from interface:IQHandlerHandles an inbound IQ stanza of typegetorset.The returned IQ must be of type
resultorerror. Ifnullis returned, no response is returned to the requester and you must take responsibility of sending a response manually. However, this approach is not recommended.Use
IQ.createResult()orIQ.createError(rocks.xmpp.core.stanza.model.StanzaError)to generate the response IQ (i.e. an IQ with the same id).- Specified by:
handleRequestin interfaceIQHandler- Parameters:
iq- The inbound IQ stanza.- Returns:
- The result or error IQ, which is the response to sending entity.
-
handleInboundMessage
public void handleInboundMessage(MessageEvent e)
Description copied from interface:InboundMessageHandlerHandles an inbound message.- Specified by:
handleInboundMessagein interfaceInboundMessageHandler- Parameters:
e- The message event.
-
getNamespace
public final String getNamespace()
Description copied from interface:ExtensionProtocolThe protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespacein interfaceExtensionProtocol- Returns:
- The main namespace.
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfoGets the features.- Specified by:
getFeaturesin interfaceDiscoverableInfo- Returns:
- The features.
-
-