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

public interface IBlockingConnection
A connection which accesses the underlying channel in a non-blocking manner. Every read I/O operation will block until it completes. The blocking behavior of write operations will be controlled by the flush configuration.
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from interface org.xsocket.connection.IConnection | 
|---|
| IConnection.FlushMode | 
| Field Summary | |
|---|---|
| static int | DEFAULT_READ_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 | 
| Method Summary | |
|---|---|
|  void | activateSecuredMode()ad hoc activation of a secured mode (SSL). | 
|  void | deactivateSecuredMode()ad hoc deactivation of a secured mode (SSL). | 
|  void | flush()flush the send buffer. | 
|  String | getEncoding()gets the encoding (used by string related methods like write(String) ...) | 
|  IConnection.FlushMode | getFlushmode()see INonBlockingConnection#setFlushmode(FlushMode) | 
|  int | getMaxReadBufferThreshold()get the max app read buffer size. | 
|  int | getPendingWriteDataSize()returns the size of the data which have already been written, but not yet transferred to the underlying socket. | 
|  int | getReadTimeoutMillis()get the timeout for calling read methods in millis | 
|  boolean | isAutoflush()get autoflush | 
|  boolean | isReceivingSuspended()returns true if receiving is suspended | 
|  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. | 
|  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 | 
|  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 | 
|  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,
                   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 | resumeReceiving()resume receiving data from the underlying subsystem | 
|  void | setAutoflush(boolean autoflush)set autoflush. | 
|  void | setEncoding(String encoding)sets the encoding (used by string related methods like write(String) ...) | 
|  void | setFlushmode(IConnection.FlushMode flushMode)see INonBlockingConnection.getFlushmode() | 
|  void | setMaxReadBufferThreshold(int size)set the max app read buffer threshold | 
|  void | setReadTimeoutMillis(int timeout)set the timeout for calling read methods in millis | 
|  void | suspendReceiving()suspend receiving data from the underlying subsystem | 
|  long | transferFrom(FileChannel source)transfer the data of the file channel to this data sink | 
|  void | unread(byte[] bytes)returns the bytes to the top of the read queue. | 
|  void | unread(ByteBuffer buffer)returns the ByteBuffer to the top of the read queue. | 
|  void | unread(ByteBuffer[] buffers)returns the ByteBuffer to the top of the read queue. | 
|  void | unread(String text)returns the text to the top of the read queue. | 
|  void | write(byte[] bytes,
      int offset,
      int length,
      IWriteCompletionHandler writeCompletionHandler)writes bytes to the data sink. | 
|  void | write(byte[] bytes,
      IWriteCompletionHandler writeCompletionHandler)writes bytes to the data sink | 
|  void | write(ByteBuffer[] srcs,
      int offset,
      int length,
      IWriteCompletionHandler writeCompletionHandler)writes a byte buffer array. | 
|  void | write(ByteBuffer[] buffers,
      IWriteCompletionHandler writeCompletionHandler)writes a byte buffer array. | 
|  void | write(ByteBuffer buffer,
      IWriteCompletionHandler writeCompletionHandler)writes a byte buffer. | 
|  void | write(List<ByteBuffer> buffers,
      IWriteCompletionHandler writeCompletionHandler)writes a list of bytes to the data sink. | 
|  int | write(String message,
      String encoding)write a message | 
|  void | write(String message,
      String encoding,
      IWriteCompletionHandler writeCompletionHandler)writes a message. | 
| Methods inherited from interface org.xsocket.connection.IConnection | 
|---|
| getAttachment, getConnectionTimeoutMillis, getId, getIdleTimeoutMillis, getLocalAddress, getLocalPort, getOption, getOptions, getRemainingMillisToConnectionTimeout, getRemainingMillisToIdleTimeout, getRemoteAddress, getRemotePort, isOpen, isServerSide, setAttachment, setConnectionTimeoutMillis, setIdleTimeoutMillis, setOption | 
| Methods inherited from interface org.xsocket.IDataSource | 
|---|
| read, readByte, readByteBufferByDelimiter, readByteBufferByDelimiter, readByteBufferByLength, readBytesByDelimiter, readBytesByDelimiter, readBytesByLength, readDouble, readInt, readLong, readShort, readStringByDelimiter, readStringByDelimiter, readStringByLength, transferTo | 
| Methods inherited from interface org.xsocket.IDataSink | 
|---|
| transferFrom, 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.Channel | 
|---|
| isOpen | 
| Methods inherited from interface java.nio.channels.ReadableByteChannel | 
|---|
| read | 
| Field Detail | 
|---|
static final int DEFAULT_READ_TIMEOUT
| Method Detail | 
|---|
void setAutoflush(boolean autoflush)
autoflush - true if autoflush should be activatedboolean isAutoflush()
void flush()
           throws ClosedChannelException,
                  IOException,
                  SocketTimeoutException
flush in interface FlushableIOException - If some other I/O error occurs
SocketTimeoutException - If the timeout has been reached
ClosedChannelException - if the underlying channel is closed
void activateSecuredMode()
                         throws IOException
IOException - If some other I/O error occurs
void deactivateSecuredMode()
                           throws IOException
IOException - If some other I/O error occursboolean isSecure()
int getPendingWriteDataSize()
void setReadTimeoutMillis(int timeout)
                          throws IOException
timeout - the timeout in millis
IOException - If some other I/O error occurs
int getReadTimeoutMillis()
                         throws IOException
IOException - If some other I/O error occurs
void suspendReceiving()
                      throws IOException
IOException - If some other I/O error occurs
void resumeReceiving()
                     throws IOException
IOException - If some other I/O error occursboolean isReceivingSuspended()
void unread(ByteBuffer[] buffers)
            throws IOException
buffers - the buffers to return
IOException - if an exception occurs
void unread(ByteBuffer buffer)
            throws IOException
buffer - the buffer to return
IOException - if an exception occurs
void unread(byte[] bytes)
            throws IOException
bytes - the bytes to return
IOException - if an exception occurs
void unread(String text)
            throws IOException
text - the text to return
IOException - if an exception occursboolean resetToWriteMark()
boolean resetToReadMark()
void markWritePosition()
void markReadPosition()
void removeReadMark()
void removeWriteMark()
String getEncoding()
void setEncoding(String encoding)
encoding - the encoding
int write(String message,
          String encoding)
          throws IOException,
                 BufferOverflowException
message - the message to writeencoding - the encoding which should be used th encode the chars into byte (e.g. `US-ASCII` or `UTF-8`)
BufferOverflowException - If the no enough space is available
IOException - If some other I/O error occurs
void write(ByteBuffer[] buffers,
           IWriteCompletionHandler writeCompletionHandler)
           throws IOException
buffers - the buffers to writewriteCompletionHandler - the completionHandler
IOException - If some I/O error occurs
void write(ByteBuffer buffer,
           IWriteCompletionHandler writeCompletionHandler)
           throws IOException
buffer - the buffer to writewriteCompletionHandler - the completionHandler
IOException - If some I/O error occurs
void write(List<ByteBuffer> buffers,
           IWriteCompletionHandler writeCompletionHandler)
           throws IOException
buffers - the bytes to writewriteCompletionHandler - the completionHandler
BufferOverflowException - If the no enough space is available
IOException - If some other I/O error occurs
void write(ByteBuffer[] srcs,
           int offset,
           int length,
           IWriteCompletionHandler writeCompletionHandler)
           throws IOException
srcs - the buffersoffset - the offsetlength - the lengthwriteCompletionHandler - the completionHandler
IOException - If some I/O error occurs
void write(byte[] bytes,
           IWriteCompletionHandler writeCompletionHandler)
           throws IOException
bytes - the bytes to writewriteCompletionHandler - the completion handler
BufferOverflowException - If the no enough space is available
IOException - If some other I/O error occurs
void write(byte[] bytes,
           int offset,
           int length,
           IWriteCompletionHandler writeCompletionHandler)
           throws IOException
bytes - 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.writeCompletionHandler - the completion handler
BufferOverflowException - If the no enough space is available
IOException - If some other I/O error occurs
void write(String message,
           String encoding,
           IWriteCompletionHandler writeCompletionHandler)
           throws IOException
message - the message to writeencoding - the encoding which should be used th encode the chars into byte (e.g. `US-ASCII` or `UTF-8`)writeCompletionHandler - the completion handler
BufferOverflowException - If the no enough space is available
IOException - If some other I/O error occurs
ByteBuffer[] readByteBufferByDelimiter(String delimiter,
                                       String encoding)
                                       throws IOException,
                                              BufferUnderflowException,
                                              SocketTimeoutException
delimiter - the delimiterencoding - the encoding to use
BufferUnderflowException - If not enough data is available
IOException - If some other I/O error occurs
SocketTimeoutException
ByteBuffer[] readByteBufferByDelimiter(String delimiter,
                                       String encoding,
                                       int maxLength)
                                       throws IOException,
                                              BufferUnderflowException,
                                              MaxReadSizeExceededException,
                                              SocketTimeoutException
delimiter - 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
BufferUnderflowException - If not enough data is available
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
byte[] readBytesByDelimiter(String delimiter,
                            String encoding)
                            throws IOException,
                                   BufferUnderflowException
delimiter - the delimiterencoding - the encoding to use
BufferUnderflowException - If not enough data is available
IOException - If some other I/O error occurs
byte[] readBytesByDelimiter(String delimiter,
                            String encoding,
                            int maxLength)
                            throws IOException,
                                   BufferUnderflowException,
                                   MaxReadSizeExceededException,
                                   SocketTimeoutException
delimiter - 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
BufferUnderflowException - If not enough data is available
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
String readStringByDelimiter(String delimiter,
                             String encoding)
                             throws IOException,
                                    BufferUnderflowException,
                                    UnsupportedEncodingException,
                                    MaxReadSizeExceededException,
                                    SocketTimeoutException
delimiter - 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
BufferUnderflowException - If not enough data is available
UnsupportedEncodingException - if the given encoding is not supported
SocketTimeoutException
String readStringByDelimiter(String delimiter,
                             String encoding,
                             int maxLength)
                             throws IOException,
                                    BufferUnderflowException,
                                    UnsupportedEncodingException,
                                    MaxReadSizeExceededException,
                                    SocketTimeoutException
delimiter - 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
BufferUnderflowException - If not enough data is available
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
String readStringByLength(int length,
                          String encoding)
                          throws IOException,
                                 BufferUnderflowException,
                                 UnsupportedEncodingException,
                                 SocketTimeoutException
length - the amount of bytes to read.encoding - the encoding to use
IOException - If some other I/O error occurs
BufferUnderflowException - If not enough data is available
UnsupportedEncodingException - if the given encoding is not supported
IllegalArgumentException, - if the length parameter is negative
SocketTimeoutException
long transferFrom(FileChannel source)
                  throws IOException,
                         BufferOverflowException
transferFrom in interface IDataSinksource - the source channel
BufferOverflowException - If the no enough space is available
IOException - If some other I/O error occursint getMaxReadBufferThreshold()
void setMaxReadBufferThreshold(int size)
maxSize - the max read buffer thresholdvoid setFlushmode(IConnection.FlushMode flushMode)
INonBlockingConnection.getFlushmode()
IConnection.FlushMode getFlushmode()
INonBlockingConnection#setFlushmode(FlushMode)
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||