com.faunos.util.test
Class DebugOutputChannel

java.lang.Object
  extended by com.faunos.util.io.FilterOutputChannel
      extended by com.faunos.util.test.DebugOutputChannel
All Implemented Interfaces:
Closeable, Channel, GatheringByteChannel, WritableByteChannel

public class DebugOutputChannel
extends FilterOutputChannel

A filter on a GatheringByteChannel that echoes whatever is written 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 written is echoed to this stream.
 
Fields inherited from class com.faunos.util.io.FilterOutputChannel
inner
 
Constructor Summary
protected DebugOutputChannel()
           
  DebugOutputChannel(GatheringByteChannel inner)
          Creates a new instance.
 
Method Summary
 void setDebugStream(PrintStream debugOut)
          Sets the debug PrintStream.
 int write(ByteBuffer src)
           
 long write(ByteBuffer[] srcs, int offset, int length)
           
 
Methods inherited from class com.faunos.util.io.FilterOutputChannel
close, isOpen, write
 
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 written is echoed to this stream. By default, this is set to std out.

See Also:
setDebugStream(PrintStream)
Constructor Detail

DebugOutputChannel

protected DebugOutputChannel()
See Also:
FilterOutputChannel.FilterOutputChannel()

DebugOutputChannel

public DebugOutputChannel(GatheringByteChannel 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

write

public int write(ByteBuffer src)
          throws IOException
Specified by:
write in interface WritableByteChannel
Overrides:
write in class FilterOutputChannel
Throws:
IOException

write

public long write(ByteBuffer[] srcs,
                  int offset,
                  int length)
           throws IOException
Specified by:
write in interface GatheringByteChannel
Overrides:
write in class FilterOutputChannel
Throws:
IOException


SourceForge.net Logo