com.crankuptheamps.client
Class TransportTraceFilter

java.lang.Object
  extended by com.crankuptheamps.client.TransportTraceFilter
All Implemented Interfaces:
TransportFilter

public class TransportTraceFilter
extends Object
implements TransportFilter

An implementation of TransportFilter for tracing message bytes to an OutputStream such as System.err. To use, instantiate and then pass to Transport's setTransportFilter, for example: Client client = new Client(...); client.connect(...); client.getTransport().setTransportFilter( new TransportTraceFilter(System.err) );


Constructor Summary
TransportTraceFilter(OutputStream stream_)
          Construct a TransportTraceFilter to trace messages on stream_.
 
Method Summary
 void incoming(ByteBuffer data)
          Called just after raw data is received from the AMPS instance.
 void outgoing(ByteBuffer data)
          Called when (typically just before) raw data is sent to the AMPS instance.
protected  void print(String prefix, ByteBuffer data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransportTraceFilter

public TransportTraceFilter(OutputStream stream_)
Construct a TransportTraceFilter to trace messages on stream_.

Parameters:
stream_ - The OutputStream to trace messages to.
Method Detail

print

protected void print(String prefix,
                     ByteBuffer data)

outgoing

public void outgoing(ByteBuffer data)
Description copied from interface: TransportFilter
Called when (typically just before) raw data is sent to the AMPS instance.

Specified by:
outgoing in interface TransportFilter
Parameters:
data - A ByteBuffer containing raw data to be sent to the AMPS instance.

incoming

public void incoming(ByteBuffer data)
Description copied from interface: TransportFilter
Called just after raw data is received from the AMPS instance.

Specified by:
incoming in interface TransportFilter
Parameters:
data - A ByteBuffer containing raw data from the AMPS instance.