mobnet
Class OutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended bymobnet.OutputStream

public class OutputStream
extends java.io.OutputStream

OutputStream.java - Class provides OutputStream functionality based on our Virtual Network This class is meant to be internally instatiated within the Socket Contstructor, therefore it should not be instantiated manually.

Author:
Avi TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Constructor Summary
OutputStream(java.lang.String destIP, int port)
          Constructor creates a new OutputStream which sends its packets to the specified port at the specified IP.
 
Method Summary
 void close()
          Closes this output stream and releases any system resources associated with this stream.
 void flush()
          As we are using a Virtual Network no bytes should be being buffered and so this method is useless
 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 i)
          Writes the specified byte to this output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputStream

public OutputStream(java.lang.String destIP,
                    int port)
Constructor creates a new OutputStream which sends its packets to the specified port at the specified IP.

Parameters:
destIP - The IP Address to which this OutputStream sends its data
port - The Port at which this OutputStream sends its data
Method Detail

write

public void write(byte[] b)
           throws java.io.IOException
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)

Parameters:
b - The data.
Throws:
java.io.IOException

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. 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. The write method of OutputStream calls the write method of one argument on each of the bytes to be written out.

Parameters:
b - The data.
off - the start offset in the data.
len - the number of bytes to write
Throws:
java.io.IOException

write

public void write(int i)
           throws java.io.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 b. The 24 high-order bits of b are ignored.

Parameters:
i - the byte to be written
Throws:
java.io.IOException

flush

public void flush()
As we are using a Virtual Network no bytes should be being buffered and so this method is useless


close

public void close()
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.