| java.lang.Object org.xsocket.connection.BlockingConnection
BlockingConnection | public class BlockingConnection implements IBlockingConnection(Code) | | Implementation of the IBlockingConnection interface. Internally a
INonBlockingConnection will be used. A BlockingConnection wraps a INonBlockingConnection . There are two ways to
create a BlockingConnection :
- by passing over the remote address (e.g. host name & port), or
- by passing over a
INonBlockingConnection , which will be wrapped
A newly created connection is in the open state. Write or read methods can be called immediately
The methods of this class are not thread-safe.
author: grro@xsocket.org |
Constructor Summary | |
public | BlockingConnection(String hostname, int port) constructor. | public | BlockingConnection(String hostname, int port, Map<String, Object> options) constructor. | public | BlockingConnection(InetAddress address, int port) | public | BlockingConnection(InetAddress address, int port, int connectTimeoutMillis) | public | BlockingConnection(InetAddress address, int port, SSLContext sslContext, boolean sslOn) constructor
Parameters: address - the remote host name Parameters: port - the remote host port Parameters: sslContext - the sslContext to use Parameters: sslOn - true, activate SSL mode. | public | BlockingConnection(InetAddress address, int port, int connectTimeoutMillis, SSLContext sslContext, boolean sslOn) constructor
Parameters: address - the remote host name Parameters: port - the remote host port Parameters: connectTimeoutMillis - the timeout of the connect procedure Parameters: sslContext - the sslContext to use Parameters: sslOn - true, activate SSL mode. | public | BlockingConnection(InetAddress address, int port, Map<String, Object> options, SSLContext sslContext, boolean sslOn) constructor
Parameters: address - the remote host name Parameters: port - the remote host port Parameters: options - the socket options Parameters: sslContext - the sslContext to use Parameters: sslOn - true, activate SSL mode. | public | BlockingConnection(InetAddress address, int port, int connectTimeoutMillis, Map<String, Object> options, SSLContext sslContext, boolean sslOn) constructor
Parameters: address - the remote host name Parameters: port - the remote host port Parameters: connectTimeoutMillis - the timeout of the connect procedure Parameters: options - the socket options Parameters: sslContext - the sslContext to use Parameters: sslOn - true, activate SSL mode. | public | BlockingConnection(String hostname, int port, SSLContext sslContext, boolean sslOn) constructor
Parameters: hostname - the remote host name Parameters: port - the remote host port Parameters: sslContext - the sslContext to use Parameters: sslOn - true, activate SSL mode. | public | BlockingConnection(INonBlockingConnection delegee) |
Method Summary | |
final public void | activateSecuredMode() | final public void | close() | final public void | flush() | final public Object | getAttachment() | final public long | getConnectionTimeoutMillis() | final INonBlockingConnection | getDelegee() | final public String | getEncoding() | public FlushMode | getFlushmode() | public String | getId() | final public long | getIdleTimeoutMillis() | final public InetAddress | getLocalAddress() | final public int | getLocalPort() | final public Object | getOption(String name) | final public Map<String, Class> | getOptions() | final public int | getPendingWriteDataSize() | final public int | getReceiveTimeoutMillis() | public long | getRemainingMillisToConnectionTimeout() | public long | getRemainingMillisToIdleTimeout() | final public InetAddress | getRemoteAddress() | final public int | getRemotePort() | final public boolean | isAutoflush() | final public boolean | isOpen() return if the data source is open. | public boolean | isSecure() | final public void | markReadPosition() | final public void | markWritePosition() | final public int | read(ByteBuffer buffer) . | final public byte | readByte() | final public ByteBuffer[] | readByteBufferByDelimiter(String delimiter) | final public ByteBuffer[] | readByteBufferByDelimiter(String delimiter, int maxLength) | final public ByteBuffer[] | readByteBufferByDelimiter(String delimiter, String encoding) | final public ByteBuffer[] | readByteBufferByDelimiter(String delimiter, String encoding, int maxLength) | final public ByteBuffer[] | readByteBufferByLength(int length) | final public byte[] | readBytesByDelimiter(String delimiter) | final public byte[] | readBytesByDelimiter(String delimiter, int maxLength) | final public byte[] | readBytesByDelimiter(String delimiter, String encoding) | final public byte[] | readBytesByDelimiter(String delimiter, String encoding, int maxLength) | final public byte[] | readBytesByLength(int length) | final public double | readDouble() | final public int | readInt() | final public long | readLong() | final public short | readShort() | final public String | readStringByDelimiter(String delimiter) | final public String | readStringByDelimiter(String delimiter, int maxLength) | final public String | readStringByDelimiter(String delimiter, String encoding) | final public String | readStringByDelimiter(String delimiter, String encoding, int maxLength) | final public String | readStringByLength(int length) | final public String | readStringByLength(int length, String encoding) | final public void | removeReadMark() | final public void | removeWriteMark() | final public boolean | resetToReadMark() | final public boolean | resetToWriteMark() | final public void | resumeRead() | final public void | setAttachment(Object obj) | final public void | setAutoflush(boolean autoflush) | final public void | setConnectionTimeoutMillis(long timeoutMillis) | final public void | setEncoding(String defaultEncoding) | public void | setFlushmode(FlushMode flushMode) | final public void | setIdleTimeoutMillis(long timeoutInMillis) | final public void | setOption(String name, Object value) | public void | setReceiveTimeoutMillis(int timeout) | final public void | suspendRead() | public String | toString() | final public long | transferFrom(ReadableByteChannel source) | final public long | transferFrom(ReadableByteChannel source, int chunkSize) | public long | transferFrom(FileChannel source) | final public long | transferTo(WritableByteChannel target, int length) | final public int | write(byte b) | final public int | write(byte... bytes) | final public int | write(byte[] bytes, int offset, int length) | final public int | write(short s) | final public int | write(int i) | final public int | write(long l) | final public int | write(double d) | final public int | write(String message) | final public int | write(String message, String encoding) | final public long | write(ArrayList<ByteBuffer> buffers) | final public long | write(List<ByteBuffer> buffers) | final public long | write(ByteBuffer[] buffers) | public long | write(ByteBuffer[] srcs, int offset, int length) | final public int | write(ByteBuffer buffer) |
BlockingConnection | public BlockingConnection(String hostname, int port) throws IOException(Code) | | constructor.
Parameters: hostname - the remote host Parameters: port - the port of the remote host to connect throws: IOException - If some other I/O error occurs |
BlockingConnection | public BlockingConnection(String hostname, int port, Map<String, Object> options) throws IOException(Code) | | constructor.
Parameters: hostname - the remote host Parameters: port - the port of the remote host to connect Parameters: options - the socket options throws: IOException - If some other I/O error occurs |
BlockingConnection | public BlockingConnection(InetAddress address, int port) throws IOException(Code) | | constructor
Parameters: address - the remote host address Parameters: port - the remote host port throws: IOException - If some other I/O error occurs |
BlockingConnection | public BlockingConnection(InetAddress address, int port, int connectTimeoutMillis) throws IOException(Code) | | constructor
Parameters: address - the remote host address Parameters: port - the remote host port Parameters: connectTimeoutMillis - the timeout of the connect procedure throws: IOException - If some other I/O error occurs |
BlockingConnection | public BlockingConnection(InetAddress address, int port, SSLContext sslContext, boolean sslOn) throws IOException(Code) | | constructor
Parameters: address - the remote host name Parameters: port - the remote host port Parameters: sslContext - the sslContext to use Parameters: sslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection.activateSecuredMode) throws: IOException - If some other I/O error occurs |
BlockingConnection | public BlockingConnection(InetAddress address, int port, int connectTimeoutMillis, SSLContext sslContext, boolean sslOn) throws IOException(Code) | | constructor
Parameters: address - the remote host name Parameters: port - the remote host port Parameters: connectTimeoutMillis - the timeout of the connect procedure Parameters: sslContext - the sslContext to use Parameters: sslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection.activateSecuredMode) throws: IOException - If some other I/O error occurs |
BlockingConnection | public BlockingConnection(InetAddress address, int port, Map<String, Object> options, SSLContext sslContext, boolean sslOn) throws IOException(Code) | | constructor
Parameters: address - the remote host name Parameters: port - the remote host port Parameters: options - the socket options Parameters: sslContext - the sslContext to use Parameters: sslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection.activateSecuredMode) throws: IOException - If some other I/O error occurs |
BlockingConnection | public BlockingConnection(InetAddress address, int port, int connectTimeoutMillis, Map<String, Object> options, SSLContext sslContext, boolean sslOn) throws IOException(Code) | | constructor
Parameters: address - the remote host name Parameters: port - the remote host port Parameters: connectTimeoutMillis - the timeout of the connect procedure Parameters: options - the socket options Parameters: sslContext - the sslContext to use Parameters: sslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection.activateSecuredMode) throws: IOException - If some other I/O error occurs |
BlockingConnection | public BlockingConnection(String hostname, int port, SSLContext sslContext, boolean sslOn) throws IOException(Code) | | constructor
Parameters: hostname - the remote host name Parameters: port - the remote host port Parameters: sslContext - the sslContext to use Parameters: sslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection.activateSecuredMode) throws: IOException - If some other I/O error occurs |
getConnectionTimeoutMillis | final public long getConnectionTimeoutMillis()(Code) | | |
getFlushmode | public FlushMode getFlushmode()(Code) | | |
getIdleTimeoutMillis | final public long getIdleTimeoutMillis()(Code) | | |
getLocalPort | final public int getLocalPort()(Code) | | |
getPendingWriteDataSize | final public int getPendingWriteDataSize()(Code) | | |
getReceiveTimeoutMillis | final public int getReceiveTimeoutMillis() throws IOException(Code) | | |
getRemainingMillisToConnectionTimeout | public long getRemainingMillisToConnectionTimeout()(Code) | | |
getRemainingMillisToIdleTimeout | public long getRemainingMillisToIdleTimeout()(Code) | | |
getRemotePort | final public int getRemotePort()(Code) | | |
isAutoflush | final public boolean isAutoflush()(Code) | | |
isOpen | final public boolean isOpen()(Code) | | return if the data source is open. Default is true
true, if the data source is open |
isSecure | public boolean isSecure()(Code) | | |
markReadPosition | final public void markReadPosition()(Code) | | |
markWritePosition | final public void markWritePosition()(Code) | | |
read | final public int read(ByteBuffer buffer) throws IOException, ClosedChannelException(Code) | | .
|
removeReadMark | final public void removeReadMark()(Code) | | |
removeWriteMark | final public void removeWriteMark()(Code) | | |
resetToReadMark | final public boolean resetToReadMark()(Code) | | |
resetToWriteMark | final public boolean resetToWriteMark()(Code) | | |
setAttachment | final public void setAttachment(Object obj)(Code) | | |
setAutoflush | final public void setAutoflush(boolean autoflush)(Code) | | |
setConnectionTimeoutMillis | final public void setConnectionTimeoutMillis(long timeoutMillis)(Code) | | |
setEncoding | final public void setEncoding(String defaultEncoding)(Code) | | |
setFlushmode | public void setFlushmode(FlushMode flushMode)(Code) | | |
setIdleTimeoutMillis | final public void setIdleTimeoutMillis(long timeoutInMillis)(Code) | | |
setReceiveTimeoutMillis | public void setReceiveTimeoutMillis(int timeout) throws IOException(Code) | | |
write | final public int write(byte b) throws IOException, BufferOverflowException(Code) | | |
write | final public int write(byte[] bytes, int offset, int length) throws IOException(Code) | | |
write | public long write(ByteBuffer[] srcs, int offset, int length) throws IOException(Code) | | |
|
|