saker.build Documentation TaskDoc JavaDoc Packages
public final class StreamPair
Simple data class for holding an input-output stream pair.

This class can be useful when one wants to pass a both ends of a communication channel as a parameter or return type. E.g. the streams of a Socket.

The class does not manage the lifecycle of the streams, users need to call close() on the if necessary.

Constructors
public
Creates a new instance for the specified input-output streams.
public
Creates a new stream pair based on a socket.
Methods
public InputStream
Gets the input stream.
public OutputStream
Gets the output stream.
public String
Returns a string representation of the object.
Creates a new instance for the specified input-output streams.
inputThe input stream.
outputThe output stream.
NullPointerExceptionIf any of the arguments are null.
Creates a new stream pair based on a socket.

The Socket.getInputStream() and Socket.getOutputStream() methods will be used to retrieve the streams.

sThe socket.
IOExceptionIn case of I/O error.
NullPointerExceptionIf the socket is null.
Gets the input stream.
The input.
Gets the output stream.
The output.
public String toString()
Overridden from: Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 
a string representation of the object.