net.i2p.client.streaming
Class I2PSocketOptionsImpl

java.lang.Object
  extended by net.i2p.client.streaming.I2PSocketOptionsImpl
All Implemented Interfaces:
I2PSocketOptions
Direct Known Subclasses:
ConnectionOptions

public class I2PSocketOptionsImpl
extends java.lang.Object
implements I2PSocketOptions

Define the configuration for streaming and verifying data on the socket.


Field Summary
static int DEFAULT_BUFFER_SIZE
           
static int DEFAULT_CONNECT_TIMEOUT
           
static int DEFAULT_WRITE_TIMEOUT
           
 
Fields inherited from interface net.i2p.client.streaming.I2PSocketOptions
PROP_BUFFER_SIZE, PROP_CONNECT_TIMEOUT, PROP_READ_TIMEOUT, PROP_WRITE_TIMEOUT
 
Constructor Summary
I2PSocketOptionsImpl()
           
I2PSocketOptionsImpl(I2PSocketOptions opts)
           
I2PSocketOptionsImpl(java.util.Properties opts)
           
 
Method Summary
 long getConnectTimeout()
          How long we will wait for the ACK from a SYN, in milliseconds.
protected static int getInt(java.util.Properties opts, java.lang.String name, int defaultVal)
           
 int getMaxBufferSize()
          How much data will we accept that hasn't been written out yet.
 long getReadTimeout()
          What is the longest we'll block on the input stream while waiting for more data.
 long getWriteTimeout()
          What is the longest we'll block on the output stream while waiting for the data to flush.
protected  void init(java.util.Properties opts)
           
 void setConnectTimeout(long ms)
          Define how long we will wait for the ACK from a SYN, in milliseconds.
 void setMaxBufferSize(int numBytes)
          How much data will we accept that hasn't been written out yet.
 void setProperties(java.util.Properties opts)
           
 void setReadTimeout(long ms)
          What is the longest we'll block on the input stream while waiting for more data.
 void setWriteTimeout(long ms)
          What is the longest we'll block on the output stream while waiting for the data to flush.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

DEFAULT_WRITE_TIMEOUT

public static final int DEFAULT_WRITE_TIMEOUT
See Also:
Constant Field Values

DEFAULT_CONNECT_TIMEOUT

public static final int DEFAULT_CONNECT_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

I2PSocketOptionsImpl

public I2PSocketOptionsImpl()

I2PSocketOptionsImpl

public I2PSocketOptionsImpl(I2PSocketOptions opts)

I2PSocketOptionsImpl

public I2PSocketOptionsImpl(java.util.Properties opts)
Method Detail

setProperties

public void setProperties(java.util.Properties opts)

init

protected void init(java.util.Properties opts)

getInt

protected static int getInt(java.util.Properties opts,
                            java.lang.String name,
                            int defaultVal)

getConnectTimeout

public long getConnectTimeout()
How long we will wait for the ACK from a SYN, in milliseconds.

Specified by:
getConnectTimeout in interface I2PSocketOptions
Returns:
milliseconds to wait, or -1 if we will wait indefinitely

setConnectTimeout

public void setConnectTimeout(long ms)
Define how long we will wait for the ACK from a SYN, in milliseconds.

Specified by:
setConnectTimeout in interface I2PSocketOptions
Parameters:
ms - timeout in ms

getReadTimeout

public long getReadTimeout()
What is the longest we'll block on the input stream while waiting for more data. If this value is exceeded, the read() throws InterruptedIOException

Specified by:
getReadTimeout in interface I2PSocketOptions
Returns:
timeout in ms

setReadTimeout

public void setReadTimeout(long ms)
What is the longest we'll block on the input stream while waiting for more data. If this value is exceeded, the read() throws InterruptedIOException

Specified by:
setReadTimeout in interface I2PSocketOptions
Parameters:
ms - timeout in ms

getMaxBufferSize

public int getMaxBufferSize()
How much data will we accept that hasn't been written out yet. After this amount has been exceeded, subsequent .write calls will block until either some data is removed or the connection is closed. If this is less than or equal to zero, there is no limit (warning: can eat ram)

Specified by:
getMaxBufferSize in interface I2PSocketOptions
Returns:
buffer size limit, in bytes

setMaxBufferSize

public void setMaxBufferSize(int numBytes)
How much data will we accept that hasn't been written out yet. After this amount has been exceeded, subsequent .write calls will block until either some data is removed or the connection is closed. If this is less than or equal to zero, there is no limit (warning: can eat ram)

Specified by:
setMaxBufferSize in interface I2PSocketOptions
Parameters:
numBytes - How much data will we accept that hasn't been written out yet.

getWriteTimeout

public long getWriteTimeout()
What is the longest we'll block on the output stream while waiting for the data to flush. If this value is exceeded, the write() throws InterruptedIOException. If this is less than or equal to zero, there is no timeout.

Specified by:
getWriteTimeout in interface I2PSocketOptions
Returns:
wait time to block on the output stream while waiting for the data to flush.

setWriteTimeout

public void setWriteTimeout(long ms)
What is the longest we'll block on the output stream while waiting for the data to flush. If this value is exceeded, the write() throws InterruptedIOException. If this is less than or equal to zero, there is no timeout.

Specified by:
setWriteTimeout in interface I2PSocketOptions
Parameters:
ms - wait time to block on the output stream while waiting for the data to flush.