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

java.lang.Objectorg.xsocket.connection.BlockingConnection
public class BlockingConnection
Implementation of the IBlockingConnection interface. Internally a INonBlockingConnection
 will be used. A BlockingConnection wraps a INonBlockingConnection. There are two ways to 
 create a BlockingConnection: 
 
INonBlockingConnection, which will be wrapped
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from interface org.xsocket.connection.IConnection | 
|---|
| IConnection.FlushMode | 
| Field Summary | 
|---|
| Fields inherited from interface org.xsocket.connection.IBlockingConnection | 
|---|
| DEFAULT_RECEIVE_TIMEOUT | 
| 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 | |
|---|---|
| BlockingConnection(InetAddress address,
                   int port)constructor | |
| BlockingConnection(InetAddress address,
                   int port,
                   int connectTimeoutMillis)constructor | |
| BlockingConnection(InetAddress address,
                   int port,
                   int connectTimeoutMillis,
                   Map<String,Object> options,
                   SSLContext sslContext,
                   boolean sslOn)constructor | |
| BlockingConnection(InetAddress address,
                   int port,
                   int connectTimeoutMillis,
                   SSLContext sslContext,
                   boolean sslOn)constructor | |
| BlockingConnection(InetAddress address,
                   int port,
                   Map<String,Object> options,
                   SSLContext sslContext,
                   boolean sslOn)constructor | |
| BlockingConnection(InetAddress address,
                   int port,
                   SSLContext sslContext,
                   boolean sslOn)constructor | |
| BlockingConnection(INonBlockingConnection delegee)Constructor. | |
| BlockingConnection(String hostname,
                   int port)constructor. | |
| BlockingConnection(String hostname,
                   int port,
                   Map<String,Object> options)constructor. | |
| BlockingConnection(String hostname,
                   int port,
                   SSLContext sslContext,
                   boolean sslOn)constructor | |
| Method Summary | |
|---|---|
|  void | activateSecuredMode()ad hoc activation of a secured mode (SSL). | 
|  void | close() | 
|  void | flush()flush the send buffer. | 
|  Object | getAttachment()Retrieves the current attachment. | 
|  long | getConnectionTimeoutMillis()gets the connection timeout | 
|  String | getEncoding()gets the encoding (used by string related methods like write(String) ...) | 
|  IConnection.FlushMode | getFlushmode()return the flush mode | 
|  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. | 
|  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. | 
|  int | getReceiveTimeoutMillis()get the timeout for calling read methods in millis | 
|  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 | 
|  boolean | isAutoflush()get autoflush | 
|  boolean | isOpen()return if the data source is open. | 
|  boolean | isSecure()returns if the connection is in secured mode | 
|  void | markReadPosition()Marks the read position in the connection. | 
|  void | markWritePosition()Marks the write position in the connection. | 
|  int | read(ByteBuffer buffer)see ReadableByteChannel.read(ByteBuffer) | 
|  byte | readByte()read a byte | 
|  ByteBuffer[] | readByteBufferByDelimiter(String delimiter)read a ByteBuffer by using a delimiter. | 
|  ByteBuffer[] | readByteBufferByDelimiter(String delimiter,
                          int maxLength)read a ByteBuffer by using a delimiter | 
|  ByteBuffer[] | readByteBufferByDelimiter(String delimiter,
                          String encoding)read a ByteBuffer by using a delimiter. | 
|  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 by using a length definition | 
|  byte[] | readBytesByDelimiter(String delimiter)read a byte array by using a delimiter For performance reasons, the ByteBuffer readByteBuffer method is generally preferable to get bytes | 
|  byte[] | readBytesByDelimiter(String delimiter,
                     int maxLength)read a byte array by using a delimiter For performance reasons, the ByteBuffer readByteBuffer method is generally preferable to get bytes | 
|  byte[] | readBytesByDelimiter(String delimiter,
                     String encoding)read a byte array by using a delimiter For performance reasons, the ByteBuffer readByteBuffer method is generally preferable to get bytes | 
|  byte[] | readBytesByDelimiter(String delimiter,
                     String encoding,
                     int maxLength)read a byte array by using a delimiter For performance reasons, the ByteBuffer readByteBuffer method is generally preferable to get bytes | 
|  byte[] | readBytesByLength(int length)read bytes by using a length definition For performance reasons, the ByteBuffer readByteBuffer method is generally preferable to get bytes | 
|  double | readDouble()read a double | 
|  int | readInt()read an int | 
|  long | readLong()read a long | 
|  short | readShort()read a short value | 
|  String | readStringByDelimiter(String delimiter)read a string by using a delimiter | 
|  String | readStringByDelimiter(String delimiter,
                      int maxLength)read a string by using a delimiter | 
|  String | readStringByDelimiter(String delimiter,
                      String encoding)read a string by using a delimiter | 
|  String | readStringByDelimiter(String delimiter,
                      String encoding,
                      int maxLength)read a string by using a delimiter | 
|  String | readStringByLength(int length)read a string by using a length definition | 
|  String | readStringByLength(int length,
                   String encoding)read a string by using a length definition | 
|  void | removeReadMark()remove the read mark | 
|  void | removeWriteMark()remove the write mark | 
|  boolean | resetToReadMark()Resets to the marked read position. | 
|  boolean | resetToWriteMark()Resets to the marked write position. | 
|  void | resumeRead()resume reading data from the underlying subsystem | 
|  void | setAttachment(Object obj)Attaches the given object to this connection | 
|  void | setAutoflush(boolean autoflush)set autoflush. | 
|  void | setConnectionTimeoutMillis(long timeoutMillis)sets the max time for a connections. | 
|  void | setEncoding(String defaultEncoding)sets the encoding (used by string related methods like write(String) ...) | 
|  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 | setIdleTimeoutMillis(long timeoutInMillis)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 | setReceiveTimeoutMillis(int timeout)set the timeout for calling read methods in millis | 
|  void | suspendRead()suspend reading data from the underlying subsystem | 
|  String | toString() | 
|  long | transferFrom(FileChannel source)transfer the data of the file channel to this data sink | 
|  long | transferFrom(ReadableByteChannel source)transfer the data of the source channel to this data sink by using the default chunk size | 
|  long | transferFrom(ReadableByteChannel source,
             int chunkSize)transfer the data of the source channel to this data sink | 
|  long | transferTo(WritableByteChannel target,
           int length)transfer the data of the this source channel to the given data sink | 
|  long | write(ArrayList<ByteBuffer> buffers) | 
|  int | write(byte... bytes)writes bytes to the data sink | 
|  int | write(byte b)writes a byte to the data sink | 
|  int | write(byte[] bytes,
      int offset,
      int length)writes bytes to the data sink | 
|  int | write(ByteBuffer buffer)see WritableByteChannel.write(ByteBuffer) | 
|  long | write(ByteBuffer[] buffers)see GatheringByteChannel.write(ByteBuffer[]) | 
|  long | write(ByteBuffer[] srcs,
      int offset,
      int length)see GatheringByteChannel.write(ByteBuffer[], int, int) | 
|  int | write(double d)writes a double to the data sink | 
|  int | write(int i)writes a int to the data sink | 
|  long | write(List<ByteBuffer> buffers)writes a list of bytes to the data sink | 
|  int | write(long l)writes a long to the data sink | 
|  int | write(short s)writes a short to the data sink | 
|  int | write(String message)writes a message | 
|  int | write(String message,
      String encoding)write a message | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public BlockingConnection(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 BlockingConnection(String hostname,
                          int port,
                          Map<String,Object> options)
                   throws IOException
hostname - the remote hostport - the port of the remote host to connectoptions - the socket options
IOException - If some other I/O error occurs
public BlockingConnection(InetAddress address,
                          int port)
                   throws IOException
address - the remote host addressport - the remote host port
IOException - If some other I/O error occurs
public BlockingConnection(InetAddress address,
                          int port,
                          int connectTimeoutMillis)
                   throws IOException
address - the remote host addressport - the remote host portconnectTimeoutMillis - the timeout of the connect procedure
IOException - If some other I/O error occurs
public BlockingConnection(InetAddress address,
                          int port,
                          SSLContext sslContext,
                          boolean sslOn)
                   throws IOException
address - the remote host nameport - the remote host portsslContext - the sslContext 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 BlockingConnection(InetAddress address,
                          int port,
                          int connectTimeoutMillis,
                          SSLContext sslContext,
                          boolean sslOn)
                   throws IOException
address - the remote host nameport - the remote host portconnectTimeoutMillis - the timeout of the connect proceduresslContext - the sslContext 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 BlockingConnection(InetAddress address,
                          int port,
                          Map<String,Object> options,
                          SSLContext sslContext,
                          boolean sslOn)
                   throws IOException
address - the remote host nameport - the remote host portoptions - the socket optionssslContext - the sslContext 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 BlockingConnection(InetAddress address,
                          int port,
                          int connectTimeoutMillis,
                          Map<String,Object> options,
                          SSLContext sslContext,
                          boolean sslOn)
                   throws IOException
address - the remote host nameport - the remote host portconnectTimeoutMillis - the timeout of the connect procedureoptions - the socket optionssslContext - the sslContext 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 BlockingConnection(String hostname,
                          int port,
                          SSLContext sslContext,
                          boolean sslOn)
                   throws IOException
hostname - the remote host nameport - the remote host portsslContext - the sslContext to usesslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection#activateSecuredMode())
    * @throws IOException If some other I/O error occurs
IOException
public BlockingConnection(INonBlockingConnection delegee)
                   throws IOException
delegee - the underlying non blocking connection
IOException - If some other I/O error occurs| Method Detail | 
|---|
public void setReceiveTimeoutMillis(int timeout)
                             throws IOException
setReceiveTimeoutMillis in interface IBlockingConnectiontimeout - the timeout in millis
IOException - If some other I/O error occurs
public final int getReceiveTimeoutMillis()
                                  throws IOException
getReceiveTimeoutMillis in interface IBlockingConnectionIOException - If some other I/O error occurspublic int getMaxReadBufferThreshold()
getMaxReadBufferThreshold in interface IBlockingConnectionpublic void setMaxReadBufferThreshold(int size)
setMaxReadBufferThreshold in interface IBlockingConnectionpublic final void setEncoding(String defaultEncoding)
setEncoding in interface IBlockingConnectiondefaultEncoding - the encodingpublic final String getEncoding()
getEncoding in interface IBlockingConnectionpublic final boolean isOpen()
isOpen in interface ChannelisOpen in interface IConnection
public final void close()
                 throws IOException
close in interface Closeableclose in interface ChannelIOException
public final void flush()
                 throws ClosedChannelException,
                        IOException,
                        SocketTimeoutException
flush in interface Flushableflush in interface IBlockingConnectionClosedChannelException - if the underlying channel is closed
IOException - If some other I/O error occurs
SocketTimeoutException - If the timeout has been reachedpublic String getId()
getId in interface IConnectionpublic final InetAddress getRemoteAddress()
getRemoteAddress in interface IConnectionpublic final int getRemotePort()
getRemotePort in interface IConnectionpublic final InetAddress getLocalAddress()
getLocalAddress in interface IConnectionpublic final int getLocalPort()
getLocalPort in interface IConnectionpublic final int getPendingWriteDataSize()
getPendingWriteDataSize in interface IBlockingConnection
public final void suspendRead()
                       throws IOException
suspendRead in interface IBlockingConnectionIOException - If some other I/O error occurs
public final void resumeRead()
                      throws IOException
resumeRead in interface IBlockingConnectionIOException - If some other I/O error occurspublic void setFlushmode(IConnection.FlushMode flushMode)
setFlushmode in interface IBlockingConnectionflushMode - FlushMode#ASYNC if flush should be performed asynchronous,
                  FlushMode#SYNC if flush should be perform synchronouspublic IConnection.FlushMode getFlushmode()
getFlushmode in interface IBlockingConnection
public final 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 occurs
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 IConnectionpublic final void setIdleTimeoutMillis(long timeoutInMillis)
setIdleTimeoutMillis in interface IConnectionpublic final long getIdleTimeoutMillis()
getIdleTimeoutMillis in interface IConnectionpublic final void setConnectionTimeoutMillis(long timeoutMillis)
setConnectionTimeoutMillis in interface IConnectionpublic final long getConnectionTimeoutMillis()
getConnectionTimeoutMillis in interface IConnectionpublic long getRemainingMillisToConnectionTimeout()
getRemainingMillisToConnectionTimeout in interface IConnectionpublic long getRemainingMillisToIdleTimeout()
getRemainingMillisToIdleTimeout in interface IConnectionpublic final void setAttachment(Object obj)
setAttachment in interface IConnectionobj - The object to be attached; may be nullpublic final Object getAttachment()
getAttachment in interface IConnectionpublic final void setAutoflush(boolean autoflush)
setAutoflush in interface IBlockingConnectionautoflush - true if autoflush should be activatedpublic final boolean isAutoflush()
isAutoflush in interface IBlockingConnection
public final void activateSecuredMode()
                               throws IOException
activateSecuredMode in interface IBlockingConnectionIOException - If some other I/O error occurspublic boolean isSecure()
isSecure in interface IBlockingConnectionpublic final void markReadPosition()
markReadPosition in interface IBlockingConnectionpublic final void markWritePosition()
markWritePosition in interface IBlockingConnection
public final int read(ByteBuffer buffer)
               throws IOException,
                      ClosedChannelException
ReadableByteChannel.read(ByteBuffer).
read in interface ReadableByteChannelread in interface IDataSourceIOException
ClosedChannelException
public final byte readByte()
                    throws IOException,
                           SocketTimeoutException
readByte in interface IDataSourceIOException - If an I/O error occurs
SocketTimeoutException
public final short readShort()
                      throws IOException,
                             SocketTimeoutException
readShort in interface IDataSourceIOException - If an I/O error occurs
SocketTimeoutException
public final int readInt()
                  throws IOException,
                         SocketTimeoutException
readInt in interface IDataSourceIOException - If an I/O error occurs
SocketTimeoutException
public final long readLong()
                    throws IOException,
                           SocketTimeoutException
readLong in interface IDataSourceIOException - If an I/O error occurs
SocketTimeoutException
public final double readDouble()
                        throws IOException,
                               SocketTimeoutException
readDouble in interface IDataSourceIOException - If an I/O error occurs
SocketTimeoutException
public final ByteBuffer[] readByteBufferByDelimiter(String delimiter)
                                             throws IOException,
                                                    SocketTimeoutException
IDataSource.readByteBufferByDelimiter(String, int) method is generally preferable.
readByteBufferByDelimiter in interface IDataSourcedelimiter - the delimiter (by using the default encoding)
IOException - If an I/O error occurs
SocketTimeoutException
public final ByteBuffer[] readByteBufferByDelimiter(String delimiter,
                                                    int maxLength)
                                             throws IOException,
                                                    MaxReadSizeExceededException,
                                                    SocketTimeoutException
readByteBufferByDelimiter in interface IDataSourcedelimiter - the delimiter (by using the default encoding)maxLength - 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
SocketTimeoutException
public final ByteBuffer[] readByteBufferByDelimiter(String delimiter,
                                                    String encoding)
                                             throws IOException,
                                                    SocketTimeoutException
readByteBufferByDelimiter in interface IBlockingConnectiondelimiter - the delimiterencoding - the encoding to use
IOException - If some other I/O error occurs
SocketTimeoutException
public final ByteBuffer[] readByteBufferByDelimiter(String delimiter,
                                                    String encoding,
                                                    int maxLength)
                                             throws IOException,
                                                    MaxReadSizeExceededException,
                                                    SocketTimeoutException
readByteBufferByDelimiter in interface IBlockingConnectiondelimiter - the delimiterencoding - the encoding of the delimitermaxLength - 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
SocketTimeoutException
public final ByteBuffer[] readByteBufferByLength(int length)
                                          throws IOException,
                                                 SocketTimeoutException
readByteBufferByLength in interface IDataSourcelength - the amount of bytes to read
IOException - If some other I/O error occurs
SocketTimeoutException
public final byte[] readBytesByDelimiter(String delimiter)
                                  throws IOException,
                                         SocketTimeoutException
readBytesByDelimiter in interface IDataSourcedelimiter - the delimiter (by using the default encoding)
IOException - If an I/O error occurs
SocketTimeoutException
public final byte[] readBytesByDelimiter(String delimiter,
                                         int maxLength)
                                  throws IOException,
                                         MaxReadSizeExceededException,
                                         SocketTimeoutException
readBytesByDelimiter in interface IDataSourcedelimiter - the delimiter (by using the default encoding)maxLength - 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
SocketTimeoutException
public final byte[] readBytesByDelimiter(String delimiter,
                                         String encoding)
                                  throws IOException,
                                         SocketTimeoutException
readBytesByDelimiter in interface IBlockingConnectiondelimiter - the delimiterencoding - the encoding to use
IOException - If some other I/O error occurs
SocketTimeoutException
public final byte[] readBytesByDelimiter(String delimiter,
                                         String encoding,
                                         int maxLength)
                                  throws IOException,
                                         MaxReadSizeExceededException,
                                         SocketTimeoutException
readBytesByDelimiter in interface IBlockingConnectiondelimiter - the delimiterencoding - the encoding to usemaxLength - 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     * @throws ClosedConnectionException If the underlying socket is already closed
IOException - If some other I/O error occurs
SocketTimeoutException
public final byte[] readBytesByLength(int length)
                               throws IOException,
                                      SocketTimeoutException
readBytesByLength in interface IDataSourcelength - the amount of bytes to read
IOException - If some other I/O error occurs
SocketTimeoutException
public final String readStringByDelimiter(String delimiter)
                                   throws IOException,
                                          UnsupportedEncodingException,
                                          SocketTimeoutException
readStringByDelimiter in interface IDataSourcedelimiter - the delimiter (by using the default encoding)
IOException - If some other I/O error occurs
UnsupportedEncodingException - if the default encoding is not supported
SocketTimeoutException
public final String readStringByDelimiter(String delimiter,
                                          int maxLength)
                                   throws IOException,
                                          UnsupportedEncodingException,
                                          MaxReadSizeExceededException,
                                          SocketTimeoutException
readStringByDelimiter in interface IDataSourcedelimiter - the delimiter (by using the default encoding)maxLength - 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
UnsupportedEncodingException - If the given encoding is not supported
SocketTimeoutException
public final String readStringByDelimiter(String delimiter,
                                          String encoding)
                                   throws IOException,
                                          UnsupportedEncodingException,
                                          MaxReadSizeExceededException,
                                          SocketTimeoutException
readStringByDelimiter in interface IBlockingConnectiondelimiter - the delimiterencoding - the encoding to use
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found
IOException - If some other I/O error occurs
UnsupportedEncodingException - if the given encoding is not supported
SocketTimeoutException
public final String readStringByDelimiter(String delimiter,
                                          String encoding,
                                          int maxLength)
                                   throws IOException,
                                          UnsupportedEncodingException,
                                          MaxReadSizeExceededException,
                                          SocketTimeoutException
readStringByDelimiter in interface IBlockingConnectiondelimiter - the delimiterencoding - the encoding to usemaxLength - 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     * @throws ClosedConnectionException If the underlying socket is already closed
IOException - If some other I/O error occurs
UnsupportedEncodingException - If the given encoding is not supported
SocketTimeoutException
public final String readStringByLength(int length)
                                throws IOException,
                                       UnsupportedEncodingException,
                                       SocketTimeoutException
readStringByLength in interface IDataSourcelength - the amount of bytes to read
IOException - If some other I/O error occurs
UnsupportedEncodingException - if the given encoding is not supported
SocketTimeoutException
public final String readStringByLength(int length,
                                       String encoding)
                                throws IOException,
                                       UnsupportedEncodingException,
                                       SocketTimeoutException
readStringByLength in interface IBlockingConnectionlength - the amount of bytes to read.encoding - the encoding to use
IOException - If some other I/O error occurs
UnsupportedEncodingException - if the given encoding is not supported
SocketTimeoutException
public final long transferTo(WritableByteChannel target,
                             int length)
                      throws IOException,
                             SocketTimeoutException
transferTo in interface IDataSourcelength - the size to transfer
ClosedChannelException - If either this channel or the target channel is closed
IOException - If some other I/O error occurs
SocketTimeoutExceptionpublic final boolean resetToWriteMark()
resetToWriteMark in interface IBlockingConnectionpublic final boolean resetToReadMark()
resetToReadMark in interface IBlockingConnectionpublic final void removeReadMark()
removeReadMark in interface IBlockingConnectionpublic final void removeWriteMark()
removeWriteMark in interface IBlockingConnection
public final int write(byte b)
                throws IOException,
                       BufferOverflowException
write in interface IDataSinkb - the byte to write
IOException - If some other I/O error occurs
BufferOverflowException - If the no enough space is available
public final int write(byte... bytes)
                throws IOException
write in interface IDataSinkbytes - the bytes to write
IOException - If some other I/O error occurs
public final int write(byte[] bytes,
                       int offset,
                       int length)
                throws IOException
write in interface IDataSinkbytes - the bytes to writeoffset - The offset of the sub array to be used; must be non-negative and no larger than array.length. The new buffer`s position will be set to this value.length - The length of the sub array to be used; must be non-negative and no larger than array.length - offset. The new buffer`s limit will be set to offset + length.
IOException - If some other I/O error occurs
public final int write(short s)
                throws IOException
write in interface IDataSinks - the short value to write
IOException - If some other I/O error occurs
public final int write(int i)
                throws IOException
write in interface IDataSinki - the int value to write
IOException - If some other I/O error occurs
public final int write(long l)
                throws IOException
write in interface IDataSinkl - the int value to write
IOException - If some other I/O error occurs
public final int write(double d)
                throws IOException
write in interface IDataSinkd - the int value to write
IOException - If some other I/O error occurs
public final int write(String message)
                throws IOException
write in interface IDataSinkmessage - the message to write
IOException - If some other I/O error occurs
public final int write(String message,
                       String encoding)
                throws IOException
write in interface IBlockingConnectionmessage - the message to writeencoding - the encoding which should be used th encode the chars into byte (e.g. `US-ASCII` or `UTF-8`)
IOException - If some other I/O error occurs
public final long write(ArrayList<ByteBuffer> buffers)
                 throws IOException
IOException
public final long write(List<ByteBuffer> buffers)
                 throws IOException
write in interface IDataSinkbuffers - the bytes to write
IOException - If some other I/O error occurs
public final long write(ByteBuffer[] buffers)
                 throws IOException
GatheringByteChannel.write(ByteBuffer[])
write in interface GatheringByteChannelwrite in interface IDataSinkIOException
public long write(ByteBuffer[] srcs,
                  int offset,
                  int length)
           throws IOException
GatheringByteChannel.write(ByteBuffer[], int, int)
write in interface GatheringByteChannelwrite in interface IDataSinkIOException
public final int write(ByteBuffer buffer)
                throws IOException
WritableByteChannel.write(ByteBuffer)
write in interface WritableByteChannelwrite in interface IDataSinkIOException
public final long transferFrom(ReadableByteChannel source)
                        throws IOException
transferFrom in interface IDataSinksource - the source channel
IOException - If some other I/O error occurs
public final long transferFrom(ReadableByteChannel source,
                               int chunkSize)
                        throws IOException
transferFrom in interface IDataSinksource - the source channelchunkSize - the chunk size to use
IOException - If some other I/O error occurs
public long transferFrom(FileChannel source)
                  throws IOException
IBlockingConnection
transferFrom in interface IBlockingConnectiontransferFrom in interface IDataSinksource - the source channel
IOException - If some other I/O error occurspublic String toString()
toString in class Object| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||