public abstract class AbstractStreamHandler extends AbstractHandler implements IStreamHandler
IStreamHandler
interface.Modifier | Constructor and Description |
---|---|
protected |
AbstractStreamHandler()
Default constructor creating an unnamed stream-oriented handler.
|
protected |
AbstractStreamHandler(ISessionConfig config)
Constructor creating an unnamed stream-oriented handler with given session
configuration object.
|
protected |
AbstractStreamHandler(String name)
Constructor creating a named stream-oriented handler.
|
protected |
AbstractStreamHandler(String name,
ISessionConfig config)
Constructor creating a named stream-oriented handler with given session
configuration object.
|
Modifier and Type | Method and Description |
---|---|
int |
available(byte[] buffer,
int off,
int len)
Determines how many bytes can be read from the input buffer after
receiving new data from the remote end.
|
int |
available(ByteBuffer buffer,
boolean flipped)
Determines how many bytes can be read from the input buffer after
receiving new data from the remote end.
|
IStreamSession |
getSession()
Returns the session that is associated with this handler.
|
void |
setSession(ISession session)
Sets the stream-oriented session that will be associated with this
handler.
|
event, event, exception, getConfig, getFactory, getName, incident, read, read, timer, timer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
event, event, exception, getConfig, getFactory, getName, incident, read, read, read, timer, timer
read, read
protected AbstractStreamHandler()
protected AbstractStreamHandler(ISessionConfig config)
config
- the session configuration object, or null
to
use the default configurationprotected AbstractStreamHandler(String name)
name
- the name for this handlerprotected AbstractStreamHandler(String name, ISessionConfig config)
name
- the name for this handlerconfig
- the session configuration object, or null
to
use the default configurationpublic void setSession(ISession session)
setSession
in interface IHandler
setSession
in interface IStreamHandler
setSession
in class AbstractHandler
session
- the sessionIllegalArgumentException
- if the session argument is not an instance of the
IStreamSession
interface.public IStreamSession getSession()
IHandler
getSession
in interface IHandler
getSession
in interface IStreamHandler
getSession
in class AbstractHandler
public int available(ByteBuffer buffer, boolean flipped)
read
method.
This method is called only if the input buffer is not backed by an array.
The type of the input buffer is specified by the implementation of the
ISessionStructureFactory
returned by the
getFactory
method.
The inner state of the passed buffer cannot be changed by this method.
This implementation always returns total number of bytes in the buffer.
available
in interface IStreamReader
buffer
- the input buffer.flipped
- specifies the current mode of the bufferpublic int available(byte[] buffer, int off, int len)
read
method.
This method is called only if the input buffer is backed by an array. The
type of the input buffer is specified by the implementation of the
ISessionStructureFactory
returned by the
getFactory
method.
The content of the passed buffer cannot be changed by this method.
This implementation always returns total number of bytes in the array
(i.e. the len
value).
available
in interface IStreamReader
buffer
- the array that backs the input buffer.off
- the offset of the arraylen
- the number of the bytes in the arrayCopyright © 2017–2022 SNF4J.ORG. All rights reserved.