public class TimeoutConnector extends java.lang.Object implements IStreamConnector
Constructor and Description |
---|
TimeoutConnector(IPlugin plugin,
IOperator operator,
java.io.InputStream in,
java.io.OutputStream out,
boolean mode,
long timeout)
Creates a new timeout connector for the specified plug-in.
|
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getInputStream()
Returns the input stream of the connector.
|
java.io.OutputStream |
getOutputStream()
Returns the output stream of the connector.
|
IPlugin |
getPlugin()
Returns the plug-in that has created the connector or
null if none.
|
void |
release()
Closes the input and output streams of the
connector.
|
public TimeoutConnector(IPlugin plugin, IOperator operator, java.io.InputStream in, java.io.OutputStream out, boolean mode, long timeout) throws java.io.IOException
plugin
- The plug-in that is requesting the connector or null, if none.operator
- The operator that is used to schedule more threads.in
- The input stream used to establish a connection.out
- The output stream used to establish a connection.mode
- False to initiate the handshake on this side of the connection,
true to initiate the handshake on the opposing side.timeout
- The timeout during the handshake and for the reception of
data. The other end of the connection must send at least one byte in a
timely manner in order to avoid disconnections.java.io.IOException
- Thrown if the handshake fails.public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface IStreamConnector
java.io.IOException
- Thrown if the connector cannot open an input stream.public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface IStreamConnector
java.io.IOException
- Thrown if the connector cannot open an output stream.public IPlugin getPlugin()
getPlugin
in interface IConnector
public void release()
release
in interface IConnector