jcontrol.net
Class SocketOutputStream

java.lang.Object
  extended by jcontrol.net.SocketOutputStream
All Implemented Interfaces:
BasicOutputStream

public class SocketOutputStream
extends Object
implements BasicOutputStream

JControl Implementation of a SocketOutputStream


Constructor Summary
protected SocketOutputStream(Socket socket)
          Constructor should only be initiated by the socket-class
 
Method Summary
 void close()
          Closes this output stream and releases any system resources associated with this stream.
protected  void finalize()
          Free internal data structures used by this socketoutputstream object.
 void flush()
          not implemented for socket streams
 void write(byte[] b)
          Writes b.length bytes from the specified byte array to this output stream.
 void write(byte[] buffer, int offset, int length)
          Writes length bytes from the specified byte array starting at offset off to this output stream.
 void write(int b)
          Writes the specified byte to this output stream.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Constructor Detail

SocketOutputStream

protected SocketOutputStream(Socket socket)
Constructor should only be initiated by the socket-class

Parameters:
socket -
Method Detail

write

public void write(int b)
           throws IOException
Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument data. The 8 high-order bits of data are ignored.

Specified by:
write in interface BasicOutputStream
Parameters:
b - - the byte.
Throws:
IOException - - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.

write

public void write(byte[] b)
           throws IOException
Description copied from interface: BasicOutputStream
Writes b.length bytes from the specified byte array to this output stream. The general contract for write(b) is that it should have exactly the same effect as the call write(b, 0, b.length).

Specified by:
write in interface BasicOutputStream
Parameters:
b - the data.
Throws:
IOException - if an I/O error occurs.
See Also:
write(byte b[], int offset, int length)

write

public void write(byte[] buffer,
                  int offset,
                  int length)
           throws IOException
Writes length bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation. If buffer is null, a NullPointerException is thrown. If offset is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Specified by:
write in interface BasicOutputStream
Parameters:
buffer - - the data.
offset - - the start offset in the data.
lenght - - the number of bytes to write.
Throws:
IOException - - if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.

close

public void close()
           throws IOException
Closes this output stream and releases any system resources associated with this stream. The general contract of close is that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.

Specified by:
close in interface BasicOutputStream
Throws:
IOException - - if an I/O error occurs.

flush

public void flush()
           throws IOException
not implemented for socket streams

Specified by:
flush in interface BasicOutputStream
Throws:
IOException - if an I/O error occurs.

finalize

protected void finalize()
Free internal data structures used by this socketoutputstream object.