org.freecompany.redline
Class WritableChannelWrapper
java.lang.Object
org.freecompany.redline.ChannelWrapper
org.freecompany.redline.WritableChannelWrapper
- All Implemented Interfaces:
- Closeable, Channel, WritableByteChannel
public class WritableChannelWrapper
- extends ChannelWrapper
- implements WritableByteChannel
Wrapper around a writable channel that allows
for observing written data.
|
Method Summary |
void |
close()
Closes the underlying channel and completes
any outstanding operations in the consumers. |
boolean |
isOpen()
Flag indicating whether the underlying channel
is open. |
int |
write(ByteBuffer buffer)
Writes data to the wrapped channel, while passing an
exact copy to the registered consumers. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
channel
protected WritableByteChannel channel
WritableChannelWrapper
public WritableChannelWrapper(WritableByteChannel channel)
write
public int write(ByteBuffer buffer)
throws IOException
- Writes data to the wrapped channel, while passing an
exact copy to the registered consumers.
- Specified by:
write in interface WritableByteChannel
- Parameters:
buffer - the buffer to write to the wrapped channel
- Returns:
- the number of bytes written
- Throws:
IOException - if an IO error occurs
close
public void close()
throws IOException
- Closes the underlying channel and completes
any outstanding operations in the consumers.
- Specified by:
close in interface Closeable- Specified by:
close in interface Channel- Overrides:
close in class ChannelWrapper
- Throws:
IOException - if an IO error occurs
isOpen
public boolean isOpen()
- Flag indicating whether the underlying channel
is open.
- Specified by:
isOpen in interface Channel
- Returns:
- true if it is open, false otherwise
Copyright © 2012. All Rights Reserved.