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.String
getNamespace()
The protocol's main namespace.Class<?>
getPayloadClass()
Gets the IQ's payload class.InBandByteStream.Open.StanzaType
getStanzaType()
Gets the stanza type.void
handleInboundMessage(MessageEvent e)
Handles an inbound message.IQ
handleRequest(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.void
setStanzaType(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:ByteStreamManager
Initiates a byte stream session with another entity.- Specified by:
initiateSession
in 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:IQHandler
Gets the IQ's payload class. Only payloads of this type are handled by this handler.- Specified by:
getPayloadClass
in interfaceIQHandler
- Returns:
- The IQ's payload class.
- See Also:
Stanza.getExtension(Class)
-
handleRequest
public IQ handleRequest(IQ iq)
Description copied from interface:IQHandler
Handles an inbound IQ stanza of typeget
orset
.The returned IQ must be of type
result
orerror
. Ifnull
is 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:
handleRequest
in 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:InboundMessageHandler
Handles an inbound message.- Specified by:
handleInboundMessage
in interfaceInboundMessageHandler
- Parameters:
e
- The message event.
-
getNamespace
public final String getNamespace()
Description copied from interface:ExtensionProtocol
The protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespace
in interfaceExtensionProtocol
- Returns:
- The main namespace.
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfo
Gets the features.- Specified by:
getFeatures
in interfaceDiscoverableInfo
- Returns:
- The features.
-
-