Package org.apache.sshd.common.io
Interface IoSession
-
- All Superinterfaces:
java.lang.AutoCloseable,java.nio.channels.Channel,java.io.Closeable,Closeable,ConnectionEndpointsIndicator,PacketWriter
- All Known Implementing Classes:
Nio2Session
public interface IoSession extends ConnectionEndpointsIndicator, PacketWriter, Closeable
-
-
Field Summary
-
Fields inherited from interface org.apache.sshd.common.Closeable
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.net.SocketAddressgetAcceptanceAddress()java.lang.ObjectgetAttribute(java.lang.Object key)Returns the value of the user-defined attribute of this session.longgetId()IoServicegetService()java.lang.ObjectremoveAttribute(java.lang.Object key)Removes a user-defined attribute with the specified key.java.lang.ObjectsetAttribute(java.lang.Object key, java.lang.Object value)Sets a user-defined attribute.java.lang.ObjectsetAttributeIfAbsent(java.lang.Object key, java.lang.Object value)Sets a user defined attribute if the attribute with the specified key is not set yet.voidshudownOutputStream()Handle received EOF.-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Methods inherited from interface org.apache.sshd.common.util.net.ConnectionEndpointsIndicator
getLocalAddress, getRemoteAddress
-
Methods inherited from interface org.apache.sshd.common.io.PacketWriter
writePacket
-
-
-
-
Method Detail
-
getId
long getId()
- Returns:
- a unique identifier for this session. Every session has its own ID which is different from any other.
-
getAcceptanceAddress
java.net.SocketAddress getAcceptanceAddress()
- Returns:
- The service address through which this session was accepted -
nullif session was initiated by this peer instead of being accepted
-
getAttribute
java.lang.Object getAttribute(java.lang.Object key)
Returns the value of the user-defined attribute of this session.- Parameters:
key- the key of the attribute- Returns:
nullif there is no attribute with the specified key
-
setAttribute
java.lang.Object setAttribute(java.lang.Object key, java.lang.Object value)Sets a user-defined attribute.- Parameters:
key- the key of the attributevalue- the value of the attribute- Returns:
- The old value of the attribute -
nullif it is new.
-
setAttributeIfAbsent
java.lang.Object setAttributeIfAbsent(java.lang.Object key, java.lang.Object value)Sets a user defined attribute if the attribute with the specified key is not set yet. This method is same with the following code except that the operation is performed atomically.if (containsAttribute(key)) { return getAttribute(key); } else { return setAttribute(key, value); }- Parameters:
key- The key of the attribute we want to setvalue- The value we want to set- Returns:
- The old value of the attribute -
nullif not found.
-
removeAttribute
java.lang.Object removeAttribute(java.lang.Object key)
Removes a user-defined attribute with the specified key.- Parameters:
key- The key of the attribute we want to remove- Returns:
- The old value of the attribute -
nullif not found.
-
shudownOutputStream
void shudownOutputStream() throws java.io.IOExceptionHandle received EOF.- Throws:
java.io.IOException- If failed to shutdown the stream
-
-