hiit.transceiver
Class ByteStreamTransceiver

java.lang.Object
  extended by hiit.transceiver.ByteStreamTransceiver
All Implemented Interfaces:
Transceiver

public class ByteStreamTransceiver
extends java.lang.Object
implements Transceiver


Constructor Summary
ByteStreamTransceiver(java.net.Socket s, java.io.InputStream in, java.io.OutputStream out)
           
 
Method Summary
 void close()
           
 int read()
           
 int read(int[] arr, int from, int lth)
          Reads lth bytes from the input stream into arr, starting from array index from
 void readFrom(java.net.Socket s)
           
 void reconnect()
           
 void write(byte[] message)
           
 void write(java.lang.String message)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteStreamTransceiver

public ByteStreamTransceiver(java.net.Socket s,
                             java.io.InputStream in,
                             java.io.OutputStream out)
Method Detail

close

public void close()
Specified by:
close in interface Transceiver

read

public int read()
Specified by:
read in interface Transceiver

readFrom

public void readFrom(java.net.Socket s)
Specified by:
readFrom in interface Transceiver

reconnect

public void reconnect()
Specified by:
reconnect in interface Transceiver

write

public void write(java.lang.String message)
           throws java.io.IOException
Specified by:
write in interface Transceiver
Throws:
java.io.IOException

write

public void write(byte[] message)
           throws java.io.IOException
Specified by:
write in interface Transceiver
Throws:
java.io.IOException

read

public int read(int[] arr,
                int from,
                int lth)
Reads lth bytes from the input stream into arr, starting from array index from

Specified by:
read in interface Transceiver
Parameters:
arr - The array to save the read bytes into.
from - The index to start filling the array from.
lth - How many bytes to read from the input stream.
Returns:
How many bytes were read.