public interface IStreamSession extends ISession
ISession
interface to cover stream-oriented functionalities.Modifier and Type | Method and Description |
---|---|
IStreamHandler |
getHandler()
Gets the stream-oriented handler associated with this session
|
IStreamSession |
getParent()
Gets the parent session.
|
ISessionPipeline<IStreamSession> |
getPipeline()
Gets the pipeline of stream-oriented sessions currently associated with this
session.
|
IFuture<Void> |
write(byte[] data)
Writes
data.length bytes from the specified byte array
to the stream-oriented channel associated with this session. |
IFuture<Void> |
write(byte[] data,
int offset,
int length)
Writes
length bytes from the specified byte array
to the stream-oriented channel associated with this session. |
IFuture<Void> |
write(ByteBuffer data)
Writes
data.remaining() bytes from the specified
byte buffer to the stream-oriented channel associated with
this session. |
IFuture<Void> |
write(ByteBuffer data,
int length)
Writes
length bytes from the specified byte buffer
to the stream-oriented channel associated with this session. |
IFuture<Void> |
write(IByteBufferHolder holder)
Writes
holder.remaining() bytes from the specified byte buffer
holder to the stream-oriented channel associated with this session. |
IFuture<Void> |
write(Object msg)
Writes a message to the stream-oriented channel associated with this
session.
|
void |
writenf(byte[] data)
Writes
data.length bytes from the specified byte array
to the stream-oriented channel associated with this session. |
void |
writenf(byte[] data,
int offset,
int length)
Writes
length bytes from the specified byte array
to the stream-oriented channel associated with this session. |
void |
writenf(ByteBuffer data)
Writes
data.remaining() bytes from the specified
byte buffer to the stream-oriented channel associated with
this session. |
void |
writenf(ByteBuffer data,
int length)
Writes
length bytes from the specified byte buffer
to the stream-oriented channel associated with this session. |
void |
writenf(IByteBufferHolder holder)
Writes
holder.remaining() bytes from the specified
byte buffer holder to the stream-oriented channel associated with
this session. |
void |
writenf(Object msg)
Writes a message to the stream-oriented channel associated with this
session.
|
allocate, close, dirtyClose, execute, executenf, getAttributes, getCloseFuture, getCodecPipeline, getConfig, getCreateFuture, getCreationTime, getEndFuture, getId, getLastIoTime, getLastReadTime, getLastWriteTime, getLocalAddress, getName, getOpenFuture, getReadBytes, getReadBytesThroughput, getReadyFuture, getRemoteAddress, getState, getTimer, getWrittenBytes, getWrittenBytesThroughput, isDataCopyingOptimized, isOpen, isReadSuspended, isWriteSuspended, quickClose, release, resumeRead, resumeWrite, suspendRead, suspendWrite
IStreamHandler getHandler()
getHandler
in interface ISession
IStreamSession getParent()
ISession
Some sessions may not implement its own I/O functionalities and use their parent's ones instead.
ISessionPipeline<IStreamSession> getPipeline()
The pipeline determines the sessions that will be processed prior to the session being the owner of the pipeline. All sessions in the pipeline along with the owning session will operate on the same connection (i.e the socket channel).
Unless the pipeline is marked for closing or a failure occurred closing of a session in the pipeline moves the processing to the next session in the pipeline or if the closed session was the last one in the pipeline to the session being the owner of the pipeline.
IFuture<Void> write(byte[] data)
data.length
bytes from the specified byte array
to the stream-oriented channel associated with this session.
The operation is asynchronous.
data
- bytes to be writtenIllegalSessionStateException
- if this session is not openvoid writenf(byte[] data)
data.length
bytes from the specified byte array
to the stream-oriented channel associated with this session.
The operation is asynchronous.
This method should be used whenever there will be no need to synchronize on a future object. This will save some resources and may improve performance.
data
- bytes to be writtenIllegalSessionStateException
- if this session is not openIFuture<Void> write(byte[] data, int offset, int length)
length
bytes from the specified byte array
to the stream-oriented channel associated with this session.
The operation is asynchronous.
data
- bytes to be writtenoffset
- offset within the array of the first byte to be writtenlength
- number of bytes to be writtenIllegalSessionStateException
- if this session is not openvoid writenf(byte[] data, int offset, int length)
length
bytes from the specified byte array
to the stream-oriented channel associated with this session.
The operation is asynchronous.
This method should be used whenever there will be no need to synchronize on a future object. This will save some resources and may improve performance.
data
- bytes to be writtenoffset
- offset within the array of the first byte to be writtenlength
- number of bytes to be writtenIllegalSessionStateException
- if this session is not openIFuture<Void> write(ByteBuffer data)
data.remaining()
bytes from the specified
byte buffer to the stream-oriented channel associated with
this session.
The operation is asynchronous.
data
- bytes to be writtenIllegalSessionStateException
- if this session is not openvoid writenf(ByteBuffer data)
data.remaining()
bytes from the specified
byte buffer to the stream-oriented channel associated with
this session.
The operation is asynchronous.
This method should be used whenever there will be no need to synchronize on a future object. This will save some resources and may improve performance.
data
- bytes to be writtenIllegalSessionStateException
- if this session is not openIFuture<Void> write(ByteBuffer data, int length)
length
bytes from the specified byte buffer
to the stream-oriented channel associated with this session.
The operation is asynchronous.
data
- bytes to be writtenlength
- number of bytes to be writtenIllegalSessionStateException
- if this session is not openvoid writenf(ByteBuffer data, int length)
length
bytes from the specified byte buffer
to the stream-oriented channel associated with this session.
The operation is asynchronous.
This method should be used whenever there will be no need to synchronize on a future object. This will save some resources and may improve performance.
data
- bytes to be writtenlength
- number of bytes to be writtenIllegalSessionStateException
- if this session is not openIFuture<Void> write(IByteBufferHolder holder)
holder.remaining()
bytes from the specified byte buffer
holder to the stream-oriented channel associated with this session.
The operation is asynchronous.
NOTE: The behavior of this method may change if the specified byte buffer holder is marked as a message.
holder
- bytes to be writtenIllegalSessionStateException
- if this session is not openIByteBufferHolder.isMessage()
void writenf(IByteBufferHolder holder)
holder.remaining()
bytes from the specified
byte buffer holder to the stream-oriented channel associated with
this session.
The operation is asynchronous.
This method should be used whenever there will be no need to synchronize on a future object. This will save some resources and may improve performance.
NOTE: The behavior of this method may change if the specified byte buffer holder is marked as a message.
holder
- bytes to be writtenIllegalSessionStateException
- if this session is not openIByteBufferHolder.isMessage()
IFuture<Void> write(Object msg)
The operation is asynchronous.
This method usually requires that the session has configured a codec
pipeline with at least one encoder that accepts the msg as the inbound
data. If a codec pipeline is not configured or no encoder accept the msg
object it still accepts messages that are of the byte[]
or
ByteBuffer
type.
msg
- the message to be writtenIllegalSessionStateException
- if this session is not openIllegalArgumentException
- if the msg
is an unexpected objectvoid writenf(Object msg)
The operation is asynchronous.
This method usually requires that the session has configured a codec
pipeline with at least one encoder that accepts the msg as the inbound
data. If a codec pipeline is not configured or no encoder accept the msg
object it still accepts messages that are of the byte[]
or
ByteBuffer
type.
This method should be used whenever there will be no need to synchronize on a future object. This will save some resources and may improve performance.
msg
- the message to be writtenIllegalSessionStateException
- if this session is not openIllegalArgumentException
- if the msg
is an unexpected objectCopyright © 2017–2022 SNF4J.ORG. All rights reserved.