public class SocketInputStream
extends java.io.FilterInputStream
SocketOutputStream
Constructor and Description |
---|
SocketInputStream(java.net.Socket socket,
java.io.InputStream stream)
Creates a SocketInputStream instance wrapping an input stream and
storing a reference to a socket that should be closed on closing
the stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream and immediately afterward closes the referenced
socket.
|
public SocketInputStream(java.net.Socket socket, java.io.InputStream stream)
socket
- The socket to close on closing the stream.stream
- The input stream to wrap.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.FilterInputStream
java.io.IOException
- If there is an error in closing the stream
or socket.