Interface BytestreamSession
-
- All Known Implementing Classes:
InBandBytestreamSession
,Socks5BytestreamSession
public interface BytestreamSession
BytestreamSession provides an interface for established bytestream sessions.There are two implementations of the interface. See
Socks5BytestreamSession
andInBandBytestreamSession
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes the bytestream session.java.io.InputStream
getInputStream()
Returns the InputStream associated with this session to send data.java.io.OutputStream
getOutputStream()
Returns the OutputStream associated with this session to receive data.int
getReadTimeout()
Returns the timeout for read operations of the input stream associated with this session.void
setReadTimeout(int timeout)
Sets the specified timeout, in milliseconds.
-
-
-
Method Detail
-
getInputStream
java.io.InputStream getInputStream() throws java.io.IOException
Returns the InputStream associated with this session to send data.- Returns:
- the InputStream associated with this session to send data
- Throws:
java.io.IOException
- if an error occurs while retrieving the input stream
-
getOutputStream
java.io.OutputStream getOutputStream() throws java.io.IOException
Returns the OutputStream associated with this session to receive data.- Returns:
- the OutputStream associated with this session to receive data
- Throws:
java.io.IOException
- if an error occurs while retrieving the output stream
-
close
void close() throws java.io.IOException
Closes the bytestream session.Closing the session will also close the input stream and the output stream associated to this session.
- Throws:
java.io.IOException
- if an error occurs while closing the session
-
getReadTimeout
int getReadTimeout() throws java.io.IOException
Returns the timeout for read operations of the input stream associated with this session. 0 returns implies that the option is disabled (i.e., timeout of infinity). Default is 0.- Returns:
- the timeout for read operations
- Throws:
java.io.IOException
- if there is an error in the underlying protocol
-
setReadTimeout
void setReadTimeout(int timeout) throws java.io.IOException
Sets the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read() call on the input stream associated with this session will block for only this amount of time. If the timeout expires, a java.net.SocketTimeoutException is raised, though the session is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout. Default is 0.- Parameters:
timeout
- the specified timeout, in milliseconds- Throws:
java.io.IOException
- if there is an error in the underlying protocol
-
-