org.ijsberg.iglu.util.io
Class Transponder

java.lang.Object
  extended by org.ijsberg.iglu.util.io.Transponder
All Implemented Interfaces:
Receiver

public class Transponder
extends Object
implements Receiver

Receives and retransmits objects asynchronously.


Field Summary
static int DEFAULT_BUFFER_SIZE
           
static long DEFAULT_POLLING_INTERVAL
           
static int DEFAULT_QUEUE_SIZE
           
protected  Thread forwarderThread
           
 
Constructor Summary
Transponder(Channel channel, Transmitter outputTransmitter)
          Creates transponder with a channel as input source.
Transponder(InputStream inputStream, Transmitter outputTransmitter)
          Constructs a StreamReader that translates input to byte arrays which are forwarded to a transmitter.
Transponder(Queue queue, Transmitter outputTransmitter)
          Creates transponder with a queue as input source.
Transponder(Transmitter outputTransmitter)
          Creates transponder with undefined input source.
 
Method Summary
 void onReceive(Object message)
          Is invoked in case a message is received.
 void onTransmissionClose()
          Is invoked in case the medium stops transmitting.
 void start()
          Starts forwarding objects.
 void stop()
          Stops forwarding objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_POLLING_INTERVAL

public static final long DEFAULT_POLLING_INTERVAL
See Also:
Constant Field Values

DEFAULT_QUEUE_SIZE

public static final int DEFAULT_QUEUE_SIZE
See Also:
Constant Field Values

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

forwarderThread

protected Thread forwarderThread
Constructor Detail

Transponder

public Transponder(Transmitter outputTransmitter)
Creates transponder with undefined input source. Input must be obtained by attaching transponder as receiver to a transmission source.

Parameters:
outputTransmitter -

Transponder

public Transponder(Queue queue,
                   Transmitter outputTransmitter)
Creates transponder with a queue as input source.

Parameters:
queue -
outputTransmitter -

Transponder

public Transponder(Channel channel,
                   Transmitter outputTransmitter)
Creates transponder with a channel as input source.

Parameters:
channel -
outputTransmitter -

Transponder

public Transponder(InputStream inputStream,
                   Transmitter outputTransmitter)
Constructs a StreamReader that translates input to byte arrays which are forwarded to a transmitter.

Note: transponder will not be able to read from alternate sources.

Parameters:
inputStream -
outputTransmitter -
Method Detail

start

public void start()
Starts forwarding objects.


stop

public void stop()
Stops forwarding objects.


onReceive

public void onReceive(Object message)
Description copied from interface: Receiver
Is invoked in case a message is received.

Specified by:
onReceive in interface Receiver
Parameters:
message -

onTransmissionClose

public void onTransmissionClose()
Description copied from interface: Receiver
Is invoked in case the medium stops transmitting.

Specified by:
onTransmissionClose in interface Receiver


Copyright © 2011. All Rights Reserved.