SocketOutputStreampublic class SocketOutputStream extends OutputStream
Fields Summary |
---|
private PlainSocketImpl | socket |
Constructors Summary |
---|
public SocketOutputStream(SocketImpl socket)Constructs a SocketOutputStream for the socket . Write
operations are forwarded to the socket .
super();
this.socket = (PlainSocketImpl) socket;
|
Methods Summary |
---|
public void | close()
socket.close();
| public void | write(byte[] buffer)
socket.write(buffer, 0, buffer.length);
| public void | write(byte[] buffer, int offset, int count)
// avoid int overflow
if (buffer != null) {
if (0 <= offset && offset <= buffer.length && 0 <= count
&& count <= buffer.length - offset) {
socket.write(buffer, offset, count);
} else {
throw new ArrayIndexOutOfBoundsException(Msg.getString("K002f"));//$NON-NLS-1$
}
} else {
throw new NullPointerException(Msg.getString("K0047"));//$NON-NLS-1$
}
| public void | write(int oneByte)
byte[] buffer = new byte[1];
buffer[0] = (byte) (oneByte & 0xFF);
socket.write(buffer, 0, 1);
|
|