feud.clientserver
Class StreamConverter

java.lang.Object
  extended byfeud.clientserver.StreamConverter

public class StreamConverter
extends java.lang.Object

Helper class to read bytes from an InputStream without reading the whole stream and without blocking if the stream has ended before all data could be read. The first two bytes in each part that should be read define the size in hi-byte/low-byte format. The converter will try to read the number of bytes indicated by this value from the stream and returns with the result.


Constructor Summary
StreamConverter()
           
 
Method Summary
static byte[] convert(java.io.InputStream is)
          Reads data from an InputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamConverter

public StreamConverter()
Method Detail

convert

public static byte[] convert(java.io.InputStream is)
Reads data from an InputStream

Parameters:
is - The stream to read from
Returns:
byte[] the data from the stream. This is the real payload, i.e. it doesn't include the size information