| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.xsocket.connection.AbstractNonBlockingStream
org.xsocket.connection.NonBlockingConnection
public final class NonBlockingConnection
Implementation of the INonBlockingConnection interface. 
 Depending on the constructor parameter waitForConnect a newly created connection is in the open state. 
 Write or read methods can be called immediately. 
 Absence of the waitForConnect parameter is equals to waitForConnect==true.  
 
The methods of this class are not thread-safe.
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from interface org.xsocket.connection.IConnection | 
|---|
| IConnection.FlushMode | 
| Field Summary | |
|---|---|
| static long | DEFAULT_SEND_TIMEOUT_MILLIS | 
| static String | SEND_TIMEOUT_KEY | 
| Fields inherited from interface org.xsocket.connection.INonBlockingConnection | 
|---|
| UNLIMITED | 
| Fields inherited from interface org.xsocket.connection.IConnection | 
|---|
| DEFAULT_AUTOFLUSH, DEFAULT_CONNECTION_TIMEOUT_MILLIS, DEFAULT_FLUSH_MODE, DEFAULT_IDLE_TIMEOUT_MILLIS, INITIAL_DEFAULT_ENCODING, MAX_TIMEOUT_MILLIS, SO_KEEPALIVE, SO_LINGER, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY | 
| Constructor Summary | |
|---|---|
|   | NonBlockingConnection(InetAddress address,
                      int port)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      boolean autoflush,
                      IConnection.FlushMode flushmode)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      boolean waitForConnect,
                      int connectTimeoutMillis)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      boolean waitForConnect,
                      int connectTimeoutMillis,
                      Executor workerPool)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      boolean waitForConnect,
                      int connectTimeoutMillis,
                      Map<String,Object> options)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      boolean waitForConnect,
                      int connectTimeoutMillis,
                      SSLContext sslContext,
                      boolean sslOn)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      boolean waitForConnect,
                      int connectTimeoutMillis,
                      SSLContext sslContext,
                      boolean sslOn,
                      Executor workerPool)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      Executor workerPool)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      int connectTimeoutMillis)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      int connectTimeoutMillis,
                      Executor workerPool)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      int connectTimeoutMillis,
                      Map<String,Object> options)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      int connectTimeoutMillis,
                      SSLContext sslContext,
                      boolean sslOn)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      int connectTimeoutMillis,
                      SSLContext sslContext,
                      boolean sslOn,
                      Executor workerPool)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      Map<String,Object> options)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      IHandler appHandler,
                      SSLContext sslContext,
                      boolean sslOn)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      int connectTimeoutMillis)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      int connectTimeoutMillis,
                      Map<String,Object> options)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      Map<String,Object> options)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      Map<String,Object> options,
                      SSLContext sslContext,
                      boolean sslOn)constructor. | 
|   | NonBlockingConnection(InetAddress address,
                      int port,
                      SSLContext sslContext,
                      boolean sslOn)constructor. | 
|   | NonBlockingConnection(InetSocketAddress address)constructor. | 
|   | NonBlockingConnection(String hostname,
                      int port)constructor. | 
|   | NonBlockingConnection(String hostname,
                      int port,
                      IHandler appHandler)constructor constructor. | 
|   | NonBlockingConnection(String hostname,
                      int port,
                      IHandler appHandler,
                      Executor workerPool)constructor constructor. | 
|   | NonBlockingConnection(String hostname,
                      int port,
                      IHandler appHandler,
                      Map<String,Object> options)constructor constructor. | 
|   | NonBlockingConnection(String hostname,
                      int port,
                      Map<String,Object> options,
                      SSLContext sslContext,
                      boolean sslOn)constructor. | 
|   | NonBlockingConnection(String hostname,
                      int port,
                      SSLContext sslContext,
                      boolean sslOn)constructor. | 
| protected  | NonBlockingConnection(org.xsocket.connection.TimeoutManager connectionManager,
                      IHandler handlerAdapter)server-side constructor | 
| Method Summary | |
|---|---|
|  void | activateSecuredMode()ad hoc activation of a secured mode (SSL). | 
|  void | close() | 
|  void | flush()flush the send buffer. | 
|  long | getConnectionTimeoutMillis()gets the connection timeout | 
|  IHandler | getHandler()gets the connection handler | 
|  String | getId()returns the id | 
|  long | getIdleTimeoutMillis()returns the idle timeout in millis. | 
|  InetAddress | getLocalAddress()returns the local address | 
|  int | getLocalPort()returns the local port | 
|  int | getMaxReadBufferThreshold()get the max app read buffer size. | 
|  long | getNumberOfReceivedBytes() | 
|  long | getNumberOfSendBytes() | 
|  Object | getOption(String name)returns the value of a option | 
|  Map<String,Class> | getOptions()Returns an unmodifiable map of the options supported by this end point. | 
|  int | getPendingWriteDataSize()returns the size of the data which have already been written, but not yet transferred to the underlying socket. | 
|  long | getRemainingMillisToConnectionTimeout()returns the remaining time before a connection timeout occurs | 
|  long | getRemainingMillisToIdleTimeout()returns the remaining time before a idle timeout occurs | 
|  InetAddress | getRemoteAddress()returns the remote address | 
|  int | getRemotePort()returns the port of the remote end point | 
|  Executor | getWorkerpool()gets the workerpool | 
| protected  int | getWriteTransferChunkeSize()returns the default chunk size for writing | 
|  int | getWriteTransferRate()gets the send delay time. | 
| protected  boolean | isDataWriteable()returns true, if the underlying data sink is open | 
| protected  boolean | isMoreInputDataExpected()returns true, if the underlying data source is open | 
|  boolean | isOpen()return if the data source is open. | 
|  boolean | isReadSuspended()returns true if read is suspended | 
|  boolean | isSecure()returns if the connection is in secured mode | 
|  boolean | isSecuredModeActivateable()returns if secured mode is activateable | 
| protected  void | onPostAppend() | 
| protected  void | onPostRead()notification method which will be called after data has been read | 
| protected  void | onWriteDataInserted()notification, that data has been inserted | 
|  ByteBuffer[] | readByteBufferByDelimiter(String delimiter,
                          String encoding,
                          int maxLength)read a ByteBuffer by using a delimiter For performance reasons, the ByteBuffer readByteBuffer method is generally preferable to get bytes | 
|  ByteBuffer[] | readByteBufferByLength(int length)read a ByteBuffer | 
| protected  ByteBuffer | readSingleByteBuffer(int length)read a byte buffer by length. | 
| protected  boolean | reset()pool support (the connection- and idle timeout and handler will not be reset) | 
|  void | resumeRead()resume reading data from the underlying subsystem | 
|  void | setConnectionTimeoutMillis(long timeoutMillis)sets the max time for a connections. | 
|  void | setFlushmode(IConnection.FlushMode flushMode)set the flush mode By setting the flush mode with ASYNC (default is SYNC) the data will be transferred to the underlying connection in a asynchronous way. | 
|  void | setHandler(IHandler hdl)set the connection handler. | 
|  void | setIdleTimeoutMillis(long timeoutMillis)sets the idle timeout in millis | 
|  void | setMaxReadBufferThreshold(int size)set the max app read buffer threshold | 
|  void | setOption(String name,
          Object value)sets the value of a option. | 
|  void | setWorkerpool(Executor workerpool)sets the worker pool | 
|  void | setWriteTransferRate(int bytesPerSecond)set the send delay time. | 
|  void | suspendRead()suspend reading data from the underlying subsystem | 
|  String | toString() | 
|  long | transferFrom(ReadableByteChannel sourceChannel)transfer the data of the source channel to this data sink | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface org.xsocket.connection.INonBlockingConnection | 
|---|
| available, getEncoding, getFlushmode, getReadBufferVersion, indexOf, indexOf, isAutoflush, markReadPosition, markWritePosition, readByteBufferByDelimiter, readBytesByDelimiter, readBytesByDelimiter, readStringByDelimiter, readStringByDelimiter, readStringByLength, removeReadMark, removeWriteMark, resetToReadMark, resetToWriteMark, setAutoflush, setEncoding, transferFrom, write | 
| Methods inherited from interface org.xsocket.connection.IConnection | 
|---|
| getAttachment, setAttachment | 
| Methods inherited from interface org.xsocket.IDataSource | 
|---|
| read, readByte, readByteBufferByDelimiter, readByteBufferByDelimiter, readBytesByDelimiter, readBytesByDelimiter, readBytesByLength, readDouble, readInt, readLong, readShort, readStringByDelimiter, readStringByDelimiter, readStringByLength, transferTo | 
| Methods inherited from interface org.xsocket.IDataSink | 
|---|
| transferFrom, write, write, write, write, write, write, write, write, write, write, write, write | 
| Methods inherited from interface java.nio.channels.GatheringByteChannel | 
|---|
| write, write | 
| Methods inherited from interface java.nio.channels.WritableByteChannel | 
|---|
| write | 
| Methods inherited from interface java.nio.channels.ReadableByteChannel | 
|---|
| read | 
| Field Detail | 
|---|
public static final String SEND_TIMEOUT_KEY
public static final long DEFAULT_SEND_TIMEOUT_MILLIS
| Constructor Detail | 
|---|
public NonBlockingConnection(String hostname,
                             int port)
                      throws IOException
hostname - the remote hostport - the port of the remote host to connect
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port)
                      throws IOException
address - the remote hostport - the port of the remote host to connect
IOException - If some other I/O error occurs
public NonBlockingConnection(InetSocketAddress address)
                      throws IOException
address - the remote host address
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             int connectTimeoutMillis)
                      throws IOException
address - the remote hostport - the port of the remote host to connectconnectTimeoutMillis - the timeout of the connect procedure
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             Map<String,Object> options)
                      throws IOException
address - the remote hostport - the port of the remote host to connectoptions - the socket options
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             int connectTimeoutMillis,
                             Map<String,Object> options)
                      throws IOException
address - the remote hostport - the port of the remote host to connectconnectTimeoutMillis - the timeout of the connect procedureoptions - the socket options
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             int connectTimeoutMillis)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)connectTimeoutMillis - the timeout of the connect procedure
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             boolean waitForConnect,
                             int connectTimeoutMillis)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)waitForConnect - true, if the constructor should block until the connection is established. If the connect fails, the handler's onData and onDisconnect method will be called (if present)connectTimeoutMillis - the timeout of the connect procedure
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             SSLContext sslContext,
                             boolean sslOn)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)sslContext - the ssl contextsslOn - true, if ssl should be activated
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             int connectTimeoutMillis,
                             SSLContext sslContext,
                             boolean sslOn)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)sslContext - the ssl contextsslOn - true, if ssl should be activatedconnectTimeoutMillis - the timeout of the connect procedure
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             boolean waitForConnect,
                             int connectTimeoutMillis,
                             SSLContext sslContext,
                             boolean sslOn)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)sslContext - the ssl contextsslOn - true, if ssl should be activatedwaitForConnect - true, if the constructor should block until the connection is established. If the connect fails, the handler's onData and onDisconnect method will be called (if present)connectTimeoutMillis - the timeout of the connect procedure
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             Map<String,Object> options)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)options - the socket options
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             int connectTimeoutMillis,
                             Map<String,Object> options)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)connectTimeoutMillis - the timeout of the connect procedureoptions - the socket options
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             boolean waitForConnect,
                             int connectTimeoutMillis,
                             Map<String,Object> options)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)waitForConnect - true, if the constructor should block until the connection is established. If the connect fails, the handler's onData and onDisconnect method will be called (if present)connectTimeoutMillis - the timeout of the connect procedureoptions - the socket options
IOException - If some other I/O error occurs
public NonBlockingConnection(String hostname,
                             int port,
                             IHandler appHandler)
                      throws IOException
hostname - the remote hostport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)
IOException - If some other I/O error occurs
public NonBlockingConnection(String hostname,
                             int port,
                             IHandler appHandler,
                             Executor workerPool)
                      throws IOException
hostname - the remote hostport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)workerPool - the worker pool to use
IOException - If some other I/O error occurs
public NonBlockingConnection(String hostname,
                             int port,
                             IHandler appHandler,
                             Map<String,Object> options)
                      throws IOException
hostname - the remote hostport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)options - the socket options
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             SSLContext sslContext,
                             boolean sslOn)
                      throws IOException
address - the remote addressport - the remote portsslContext - the ssl context to usesslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection#activateSecuredMode())
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             Map<String,Object> options,
                             SSLContext sslContext,
                             boolean sslOn)
                      throws IOException
address - the remote addressport - the remote portoptions - the socket optionssslContext - the ssl context to usesslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection#activateSecuredMode())
IOException - If some other I/O error occurs
public NonBlockingConnection(String hostname,
                             int port,
                             SSLContext sslContext,
                             boolean sslOn)
                      throws IOException
hostname - the remote hostport - the remote portsslContext - the ssl context to usesslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection#activateSecuredMode())
IOException - If some other I/O error occurs
public NonBlockingConnection(String hostname,
                             int port,
                             Map<String,Object> options,
                             SSLContext sslContext,
                             boolean sslOn)
                      throws IOException
hostname - the remote hostport - the remote portoptions - the socket optionssslContext - the ssl context to usesslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection#activateSecuredMode())
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             Executor workerPool)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)workerPool - the worker pool to use
IOException - If some other I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             int connectTimeoutMillis,
                             Executor workerPool)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)connectTimeoutMillis - the timeout of the connect procedureworkerPool - the worker pool to use
IOException - if a I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             boolean waitForConnect,
                             int connectTimeoutMillis,
                             Executor workerPool)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)waitForConnect - true, if the constructor should block until the connection is established. If the connect fails, the handler's onData and onDisconnect method will be called (if present)connectTimeoutMillis - the timeout of the connect procedureworkerPool - the worker pool to use
IOException - if a I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             int connectTimeoutMillis,
                             SSLContext sslContext,
                             boolean sslOn,
                             Executor workerPool)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)rconnectTimeoutMillis - the timeout of the connect proceduresslContext - the ssl context to usesslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection#activateSecuredMode())workerPool - the worker pool to use
IOException - if a I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             boolean waitForConnect,
                             int connectTimeoutMillis,
                             SSLContext sslContext,
                             boolean sslOn,
                             Executor workerPool)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)r
    * @param waitForConnect        true, if the constructor should block until the connection is established. If the connect fails, the handler's onData and onDisconnect method will be called (if present)connectTimeoutMillis - the timeout of the connect proceduresslContext - the ssl context to usesslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection#activateSecuredMode())workerPool - the worker pool to use
IOException - if a I/O error occurs
public NonBlockingConnection(InetAddress address,
                             int port,
                             IHandler appHandler,
                             boolean autoflush,
                             IConnection.FlushMode flushmode)
                      throws IOException
address - the remote addressport - the remote portappHandler - the application handler (supported: IConnectHandler, IDisconnectHandler, IDataHandler, IIdleTimeoutHandler and IConnectionTimeoutHandler)autoflush - the auto flush modeflushmode - the flush mode
IOException - if a I/O error occurs
protected NonBlockingConnection(org.xsocket.connection.TimeoutManager connectionManager,
                                IHandler handlerAdapter)
                         throws IOException
IOException| Method Detail | 
|---|
public int getMaxReadBufferThreshold()
getMaxReadBufferThreshold in interface INonBlockingConnectionpublic void setMaxReadBufferThreshold(int size)
setMaxReadBufferThreshold in interface INonBlockingConnectionprotected boolean isMoreInputDataExpected()
isMoreInputDataExpected in class AbstractNonBlockingStreamprotected boolean isDataWriteable()
isDataWriteable in class AbstractNonBlockingStream
public final void setHandler(IHandler hdl)
                      throws IOException
setHandler in interface INonBlockingConnectionhdl - the handler
IOException - If some other I/O error occurspublic IHandler getHandler()
getHandler in interface INonBlockingConnectionpublic void setWorkerpool(Executor workerpool)
workerpool - the worker poolpublic Executor getWorkerpool()
getWorkerpool in interface INonBlockingConnectionpublic final void setFlushmode(IConnection.FlushMode flushMode)
setFlushmode in interface INonBlockingConnectionsetFlushmode in class AbstractNonBlockingStreamflushMode - IConnection.FlushMode.ASYNC if flush should be performed asynchronous,
                  IConnection.FlushMode.SYNC if flush should be perform synchronousprotected boolean reset()
reset in class AbstractNonBlockingStreampublic final boolean isOpen()
isOpen in interface ChannelisOpen in interface IConnectionisOpen in interface INonBlockingConnectionprotected void onPostAppend()
onPostAppend in class AbstractNonBlockingStream
protected void onPostRead()
                   throws IOException
AbstractNonBlockingStream
onPostRead in class AbstractNonBlockingStreamIOException - If some other I/O error occurspublic long getRemainingMillisToConnectionTimeout()
getRemainingMillisToConnectionTimeout in interface IConnectionpublic long getRemainingMillisToIdleTimeout()
getRemainingMillisToIdleTimeout in interface IConnectionpublic long getNumberOfReceivedBytes()
public long getNumberOfSendBytes()
public final void setWriteTransferRate(int bytesPerSecond)
                                throws ClosedChannelException,
                                       IOException
INonBlockingConnection#setFlushmode(org.xsocket.connection.IConnection.FlushMode))
setWriteTransferRate in interface INonBlockingConnectionbytesPerSecond - the transfer rate of the outgoing data
ClosedChannelException - If the underlying socket is already closed
IOException - If some other I/O error occurs
public int getWriteTransferRate()
                         throws ClosedChannelException,
                                IOException
getWriteTransferRate in interface INonBlockingConnectionClosedChannelException - If the underlying socket is already closed
IOException - If some other I/O error occurspublic final boolean isSecuredModeActivateable()
isSecuredModeActivateable in interface INonBlockingConnection
public final void activateSecuredMode()
                               throws IOException
activateSecuredMode in interface INonBlockingConnectionIOException - If some other I/O error occurspublic boolean isSecure()
isSecure in interface INonBlockingConnection
public final ByteBuffer[] readByteBufferByDelimiter(String delimiter,
                                                    String encoding,
                                                    int maxLength)
                                             throws IOException,
                                                    BufferUnderflowException,
                                                    MaxReadSizeExceededException
readByteBufferByDelimiter in interface INonBlockingConnectionreadByteBufferByDelimiter in class AbstractNonBlockingStreamdelimiter - the delimiterencoding - the delimiter encodingmaxLength - the max length of bytes that should be read. If the limit is exceeded a MaxReadSizeExceededException will been thrown
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found
IOException - If some other I/O error occurs
ClosedChannelException - If the stream is closed
BufferUnderflowException - if not enough data is available
public ByteBuffer[] readByteBufferByLength(int length)
                                    throws IOException,
                                           BufferUnderflowException
readByteBufferByLength in interface IDataSourcereadByteBufferByLength in class AbstractNonBlockingStreamlength - the length could be negative, in this case a empty array will be returned
IOException - If some other I/O error occurs
ClosedChannelException - If the stream is closed
BufferUnderflowException - if not enough data is available
protected ByteBuffer readSingleByteBuffer(int length)
                                   throws IOException,
                                          ClosedChannelException,
                                          BufferUnderflowException
readSingleByteBuffer in class AbstractNonBlockingStreamlength - the length
IOException - If some other I/O error occurs
ClosedChannelException - If the stream is closed
BufferUnderflowException - if not enough data is availablepublic final void setIdleTimeoutMillis(long timeoutMillis)
setIdleTimeoutMillis in interface IConnectionpublic final void setConnectionTimeoutMillis(long timeoutMillis)
setConnectionTimeoutMillis in interface IConnectionpublic final long getConnectionTimeoutMillis()
getConnectionTimeoutMillis in interface IConnectionpublic final long getIdleTimeoutMillis()
getIdleTimeoutMillis in interface IConnectionpublic final InetAddress getLocalAddress()
getLocalAddress in interface IConnectionpublic final String getId()
getId in interface IConnectionpublic final int getLocalPort()
getLocalPort in interface IConnectionpublic final InetAddress getRemoteAddress()
getRemoteAddress in interface IConnectionpublic final int getRemotePort()
getRemotePort in interface IConnectionpublic final int getPendingWriteDataSize()
getPendingWriteDataSize in interface INonBlockingConnection
public final void suspendRead()
                       throws IOException
suspendRead in interface INonBlockingConnectionIOException - If some other I/O error occurspublic boolean isReadSuspended()
isReadSuspended in interface INonBlockingConnection
public final void resumeRead()
                      throws IOException
resumeRead in interface INonBlockingConnectionIOException - If some other I/O error occurs
public long transferFrom(ReadableByteChannel sourceChannel)
                  throws ClosedChannelException,
                         IOException
transferFrom in interface IDataSinktransferFrom in class AbstractNonBlockingStreamsourceChannel - the source channel
ClosedChannelException - If the stream is closed
IOException - If some other I/O error occurs
protected void onWriteDataInserted()
                            throws IOException,
                                   ClosedChannelException
onWriteDataInserted in class AbstractNonBlockingStreamIOException - if an exception occurs
ClosedChannelException - if the stream is closed
public final Object getOption(String name)
                       throws IOException
getOption in interface IConnectionname - the name of the option
IOException - In an I/O error occurspublic final Map<String,Class> getOptions()
getOptions in interface IConnection
public void setOption(String name,
                      Object value)
               throws IOException
http://www.onlamp.com/lpt/a/6324
setOption in interface IConnectionname - the name of the optionvalue - the value of the option
IOException - In an I/O error occursprotected int getWriteTransferChunkeSize()
AbstractNonBlockingStream
getWriteTransferChunkeSize in class AbstractNonBlockingStream
public void close()
           throws IOException
close in interface Closeableclose in interface Channelclose in class AbstractNonBlockingStreamIOException
public final void flush()
                 throws ClosedChannelException,
                        IOException
flush in interface Flushableflush in interface INonBlockingConnectionClosedChannelException - if the underlying channel is closed
IOException - If some other I/O error occurs
SocketTimeoutException - If the timeout has been reachedpublic String toString()
toString in class Object| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||