com.faunos.util.test
Class DebugInputChannel

java.lang.Object
  extended by com.faunos.util.io.FilterInputChannel
      extended by com.faunos.util.test.DebugInputChannel
All Implemented Interfaces:
Closeable, Channel, ReadableByteChannel, ScatteringByteChannel

public class DebugInputChannel
extends FilterInputChannel

A filter on a ScatteringByteChannel that echoes whatever is read to a PrintStream. The data is assumed to be ASCII; non-ASCII bytes are echoed as %[hex value].

Author:
Babak Farhang

Field Summary
protected  PrintStream debugOut
          What was just read is echoed to this stream.
 
Fields inherited from class com.faunos.util.io.FilterInputChannel
inner
 
Constructor Summary
protected DebugInputChannel()
           
  DebugInputChannel(ScatteringByteChannel inner)
          Creates a new instance.
 
Method Summary
 int read(ByteBuffer dst)
           
 long read(ByteBuffer[] dsts, int offset, int length)
           
 void setDebugStream(PrintStream debugOut)
          Sets the debug PrintStream.
 
Methods inherited from class com.faunos.util.io.FilterInputChannel
close, isOpen, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugOut

protected PrintStream debugOut
What was just read is echoed to this stream. By default, this is set to std out.

See Also:
setDebugStream(PrintStream)
Constructor Detail

DebugInputChannel

protected DebugInputChannel()
See Also:
FilterInputChannel.FilterInputChannel()

DebugInputChannel

public DebugInputChannel(ScatteringByteChannel inner)
Creates a new instance.

Method Detail

setDebugStream

public void setDebugStream(PrintStream debugOut)
Sets the debug PrintStream. By default, this is set to std out.

See Also:
debugOut

read

public int read(ByteBuffer dst)
         throws IOException
Specified by:
read in interface ReadableByteChannel
Overrides:
read in class FilterInputChannel
Throws:
IOException

read

public long read(ByteBuffer[] dsts,
                 int offset,
                 int length)
          throws IOException
Specified by:
read in interface ScatteringByteChannel
Overrides:
read in class FilterInputChannel
Throws:
IOException


SourceForge.net Logo