|
Smack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamSession
public class InBandBytestreamSession
InBandBytestreamSession class represents an In-Band Bytestream session.
In-band bytestreams are bidirectional and this session encapsulates the streams for both directions.
Note that closing the In-Band Bytestream session will close both streams. If both streams are
closed individually the session will be closed automatically once the second stream is closed.
Use the setCloseBothStreamsEnabled(boolean)
method if both streams should be closed
automatically if one of them is closed.
Constructor Summary | |
---|---|
protected |
InBandBytestreamSession(Connection connection,
Open byteStreamRequest,
String remoteJID)
Constructor. |
Method Summary | |
---|---|
void |
close()
Closes the bytestream session. |
protected void |
closeByLocal(boolean in)
This method is invoked if one of the streams has been closed locally, if an error occurred locally or if the whole session should be closed. |
protected void |
closeByPeer(Close closeRequest)
This method is invoked if a request to close the In-Band Bytestream has been received. |
InputStream |
getInputStream()
Returns the InputStream associated with this session to send data. |
OutputStream |
getOutputStream()
Returns the OutputStream associated with this session to receive data. |
int |
getReadTimeout()
Returns the timeout for read operations of the input stream associated with this session. |
boolean |
isCloseBothStreamsEnabled()
Returns whether both streams should be closed automatically if one of the streams is closed. |
void |
setCloseBothStreamsEnabled(boolean closeBothStreamsEnabled)
Sets whether both streams should be closed automatically if one of the streams is closed. |
void |
setReadTimeout(int timeout)
Sets the specified timeout, in milliseconds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected InBandBytestreamSession(Connection connection, Open byteStreamRequest, String remoteJID)
connection
- the XMPP connectionbyteStreamRequest
- the In-Band Bytestream open request for this sessionremoteJID
- JID of the remote peerMethod Detail |
---|
public InputStream getInputStream()
BytestreamSession
getInputStream
in interface BytestreamSession
public OutputStream getOutputStream()
BytestreamSession
getOutputStream
in interface BytestreamSession
public int getReadTimeout()
BytestreamSession
getReadTimeout
in interface BytestreamSession
public void setReadTimeout(int timeout)
BytestreamSession
setReadTimeout
in interface BytestreamSession
timeout
- the specified timeout, in millisecondspublic boolean isCloseBothStreamsEnabled()
false
.
true
if both streams will be closed if one of the streams is closed,
false
if both streams can be closed independently.public void setCloseBothStreamsEnabled(boolean closeBothStreamsEnabled)
false
.
closeBothStreamsEnabled
- true
if both streams should be closed if one of
the streams is closed, false
if both streams should be closed
independentlypublic void close() throws IOException
BytestreamSession
Closing the session will also close the input stream and the output stream associated to this session.
close
in interface BytestreamSession
IOException
- if an error occurs while closing the sessionprotected void closeByPeer(Close closeRequest)
closeRequest
- the close request from the remote peerprotected void closeByLocal(boolean in) throws IOException
IOException
- if an error occurs while sending the close request
|
Smack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |