org.neo.swarm.util.io
Class PacketOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byorg.neo.swarm.util.io.PacketOutputStream

public class PacketOutputStream
extends java.io.OutputStream

Provides a custom packet protocol as defined in the PacketInputStream. Note: Alternative implementations of the these streams could be written to handle different wire protocol such as SOAP or HTTP.

Author:
navery
See Also:
PacketInputStream

Constructor Summary
PacketOutputStream(java.io.OutputStream parent)
           
 
Method Summary
 void close()
           
 void flush()
           
static byte[] toBytes(int n)
          Converts an integer to four bytes
 void write(byte[] data)
           
 void write(int arg0)
           
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PacketOutputStream

public PacketOutputStream(java.io.OutputStream parent)
Method Detail

write

public void write(int arg0)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(byte[] data)
           throws java.io.IOException
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

toBytes

public static byte[] toBytes(int n)
Converts an integer to four bytes

Parameters:
n - - the integer
Returns:
- four bytes in an array


Copyright © 2001-2004 SWARM-ONE -First Generation (S)calable(W)ide(AR)ea(M)esh. All Rights Reserved.