jist.swans.trans
Class TcpOutputStream

java.lang.Object
  extended by jist.swans.app.io.OutputStream
      extended by jist.swans.trans.TcpOutputStream

public class TcpOutputStream
extends OutputStream

SWANS Implementation of OutputStream for Socket.

Since:
SWANS1.0
Version:
$Id: TcpOutputStream.java,v 1.7 2004/04/06 16:07:51 barr Exp $
Author:
Kelwin Tamtoro <kt222@cs.cornell.edu>, Rimon Barr <barr+jist@cs.cornell.edu>

Field Summary
(package private)  boolean isClosed
          The closed state of the output stream.
(package private)  SocketInterface.TcpSocketInterface socketEntity
          Entity reference to Socket object.
 
Constructor Summary
TcpOutputStream(SocketInterface.TcpSocketInterface entity)
          Constructor.
 
Method Summary
 void close()
          Closes this output stream and releases any system resources associated with this stream.
 void write(byte[] b)
          Writes b.length bytes from the specified byte array to this output stream.
 void write(byte[] b, int off, int len)
          Writes len 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 jist.swans.app.io.OutputStream
flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socketEntity

SocketInterface.TcpSocketInterface socketEntity
Entity reference to Socket object.


isClosed

boolean isClosed
The closed state of the output stream.

Constructor Detail

TcpOutputStream

public TcpOutputStream(SocketInterface.TcpSocketInterface entity)
Constructor.

Parameters:
entity - entity reference to Socket
Method Detail

close

public void close()
           throws java.io.IOException
Closes this output stream and releases any system resources associated with this stream.

Overrides:
close in class OutputStream
Throws:
java.io.IOException - if an I/O error occurs
See Also:
OutputStream

write

public void write(byte[] b)
           throws java.io.IOException
Writes b.length bytes from the specified byte array to this output stream.

Overrides:
write in class OutputStream
Parameters:
b - the data
Throws:
java.io.IOException - if an I/O error occurs
See Also:
OutputStream

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Writes len bytes from the specified byte array starting at offset off to this output stream.

Overrides:
write in class OutputStream
Parameters:
b - the data
off - the start offset in the data
len - the number of bytes to write
Throws:
java.io.IOException - if an I/O error occurs
See Also:
OutputStream

write

public void write(int b)
           throws java.io.IOException
Writes the specified byte to this output stream.

Specified by:
write in class OutputStream
Parameters:
b - the byte
Throws:
java.io.IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
See Also:
OutputStream