public class SocketOutputStream
extends java.io.FilterOutputStream
SocketInputStream
构造器和说明 |
---|
SocketOutputStream(java.net.Socket socket,
java.io.OutputStream stream)
Creates a SocketOutputStream instance wrapping an output stream and
storing a reference to a socket that should be closed on closing
the stream.
|
public SocketOutputStream(java.net.Socket socket, java.io.OutputStream stream)
socket
- The socket to close on closing the stream.stream
- The input stream to wrap.public void write(byte[] buffer, int offset, int length) throws java.io.IOException
write
在类中 java.io.FilterOutputStream
buffer
- The byte array to write.offset
- The offset into the array at which to start copying data.length
- The number of bytes to write.java.io.IOException
- If an error occurs while writing to the underlying
stream.public void close() throws java.io.IOException
close
在接口中 java.io.Closeable
close
在接口中 java.lang.AutoCloseable
close
在类中 java.io.FilterOutputStream
java.io.IOException
- If there is an error in closing the stream
or socket.