Top Methods
org.apache.sshd.common.io

public Interface IoSession

extends ConnectionEndpointsIndicator, Closeable
Imports
java.io.IOException, java.net.SocketAddress, org.apache.sshd.common.Closeable, org.apache.sshd.common.future.CloseFuture, org.apache.sshd.common.util.buffer.Buffer, org.apache.sshd.common.util.net.ConnectionEndpointsIndicator

Method Summary

Modifier and TypeMethod and Description
public CloseFuture

Returns:

The generated CloseFuture
close
(boolean
true to close this session immediately. The pending write requests will simply be discarded. false to close this session after all queued write requests are flushed.
immediately
)

Redeclares org.apache.sshd.common.Closeable.close.

Closes this session immediately or after all queued write requests are flushed.

public SocketAddress

Returns:

The service address through which this session was accepted - null if session was initiated by this peer instead of being accepted
getAcceptanceAddress
()

public Object

Returns:

null if there is no attribute with the specified key
getAttribute
(Object
the key of the attribute
key
)

Returns the value of the user-defined attribute of this session.

public long

Returns:

a unique identifier for this session. Every session has its own ID which is different from any other.
getId
()

public IoService

Returns:

the IoService that created this session.
getService
()

public Object

Returns:

The old value of the attribute - null if not found.
removeAttribute
(Object
The key of the attribute we want to remove
key
)

Removes a user-defined attribute with the specified key.

public void
resumeRead()

Resume read operations on this session.

public Object

Returns:

The old value of the attribute - null if it is new.
setAttribute
(Object
the key of the attribute
key
,
Object
the value of the attribute
value
)

Sets a user-defined attribute.

public Object

Returns:

The old value of the attribute - null if not found.
setAttributeIfAbsent
(Object
The key of the attribute we want to set
key
,
Object
The value we want to set
value
)

Sets a user defined attribute if the attribute with the specified key is not set yet.

public void
shutdownOutputStream()

Handle received EOF.

public void
suspendRead()

Suspend read operations on this session.

public IoWriteFuture

Returns:

An IoWriteFuture that can be used to check when the packet has actually been sent
writeBuffer
(Buffer
the buffer send

Note

the buffer must not be touched until the returned write future is completed.

buffer
)

Write a packet on the socket.

Inherited from org.apache.sshd.common.Closeable:
addCloseFutureListenercloseclosegetMaxCloseWaitTimeisClosedisClosingisOpenremoveCloseFutureListener
Inherited from org.apache.sshd.common.util.net.ConnectionEndpointsIndicator:
getLocalAddressgetRemoteAddress

Method Detail

closeback to summary
public CloseFuture close(boolean immediately)

Redeclares org.apache.sshd.common.Closeable.close.

Closes this session immediately or after all queued write requests are flushed. This operation is asynchronous. Wait for the returned CloseFuture if you want to wait for the session actually closed.

Parameters
immediately:boolean

true to close this session immediately. The pending write requests will simply be discarded. false to close this session after all queued write requests are flushed.

Returns:CloseFuture

The generated CloseFuture

Annotations
@Override
getAcceptanceAddressback to summary
public SocketAddress getAcceptanceAddress()
Returns:SocketAddress

The service address through which this session was accepted - null if session was initiated by this peer instead of being accepted

getAttributeback to summary
public Object getAttribute(Object key)

Returns the value of the user-defined attribute of this session.

Parameters
key:Object

the key of the attribute

Returns:Object

null if there is no attribute with the specified key

getIdback to summary
public long getId()
Returns:long

a unique identifier for this session. Every session has its own ID which is different from any other.

getServiceback to summary
public IoService getService()
Returns:IoService

the IoService that created this session.

removeAttributeback to summary
public Object removeAttribute(Object key)

Removes a user-defined attribute with the specified key.

Parameters
key:Object

The key of the attribute we want to remove

Returns:Object

The old value of the attribute - null if not found.

resumeReadback to summary
public void resumeRead()

Resume read operations on this session.

setAttributeback to summary
public Object setAttribute(Object key, Object value)

Sets a user-defined attribute.

Parameters
key:Object

the key of the attribute

value:Object

the value of the attribute

Returns:Object

The old value of the attribute - null if it is new.

setAttributeIfAbsentback to summary
public Object setAttributeIfAbsent(Object key, 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:Object

The key of the attribute we want to set

value:Object

The value we want to set

Returns:Object

The old value of the attribute - null if not found.

shutdownOutputStreamback to summary
public void shutdownOutputStream() throws IOException

Handle received EOF.

Exceptions
IOException:
If failed to shutdown the stream
suspendReadback to summary
public void suspendRead()

Suspend read operations on this session. If the session usage includes a graceful shutdown with messages being exchanged, the caller needs to take care of resuming reading the input in order to actually be able to carry on the conversation with the peer.

writeBufferback to summary
public IoWriteFuture writeBuffer(Buffer buffer) throws IOException

Write a packet on the socket. Multiple writes can be issued concurrently and will be queued.

Parameters
buffer:Buffer

the buffer send

Note

the buffer must not be touched until the returned write future is completed.

Returns:IoWriteFuture

An IoWriteFuture that can be used to check when the packet has actually been sent

Exceptions
IOException:
if an error occurred when sending the packet