LimeWire Consolidated API

org.limewire.nio.channel
Class AbstractChannelInterestWriter

java.lang.Object
  extended by org.limewire.nio.channel.AbstractChannelInterestWriter
All Implemented Interfaces:
Closeable, Channel, WritableByteChannel, ChannelWriter, InterestWritableByteChannel, IOErrorObserver, Shutdownable, WriteObserver
Direct Known Subclasses:
StatisticGatheringWriter

public abstract class AbstractChannelInterestWriter
extends Object
implements ChannelWriter, InterestWritableByteChannel

A basic channel writer that just forwards all information to the next channel in line.


Constructor Summary
AbstractChannelInterestWriter()
           
 
Method Summary
 void close()
          Closes the underlying channel.
 InterestWritableByteChannel getWriteChannel()
          Returns the write target, AKA sink.
 void handleIOException(IOException x)
          Unused, Unsupported
 boolean handleWrite()
          Notification that a write can be performed.
 boolean hasBufferedOutput()
          Returns true, if the channel has buffered data.
 void interestWrite(WriteObserver observer, boolean status)
          Marks the given observer as interested (or not interested, if status is false) in knowing when a write can be performed on this channel.
 boolean isOpen()
          Determines if the underlying channel is open.
 void setWriteChannel(InterestWritableByteChannel channel)
          Set the write target, AKA sink.
 void shutdown()
          Releases any resources used by this component.
 int write(ByteBuffer src)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractChannelInterestWriter

public AbstractChannelInterestWriter()
Method Detail

getWriteChannel

public InterestWritableByteChannel getWriteChannel()
Returns the write target, AKA sink.

Specified by:
getWriteChannel in interface ChannelWriter

setWriteChannel

public void setWriteChannel(InterestWritableByteChannel channel)
Set the write target, AKA sink. This object should immediately register interest with the newChannel if there is any data to be written.

Specified by:
setWriteChannel in interface ChannelWriter

interestWrite

public void interestWrite(WriteObserver observer,
                          boolean status)
Marks the given observer as interested (or not interested, if status is false) in knowing when a write can be performed on this channel.

Specified by:
interestWrite in interface InterestWritableByteChannel

close

public void close()
           throws IOException
Closes the underlying channel.

Specified by:
close in interface Closeable
Specified by:
close in interface Channel
Throws:
IOException

isOpen

public boolean isOpen()
Determines if the underlying channel is open.

Specified by:
isOpen in interface Channel

shutdown

public void shutdown()
Description copied from interface: Shutdownable
Releases any resources used by this component.

shutdown must never throw any exceptions.

Specified by:
shutdown in interface Shutdownable

handleIOException

public void handleIOException(IOException x)
Unused, Unsupported

Specified by:
handleIOException in interface IOErrorObserver

hasBufferedOutput

public boolean hasBufferedOutput()
Description copied from interface: InterestWritableByteChannel
Returns true, if the channel has buffered data. If the channel is closed before this method returns false the buffered data is lost.

Specified by:
hasBufferedOutput in interface InterestWritableByteChannel

handleWrite

public boolean handleWrite()
                    throws IOException
Description copied from interface: WriteObserver
Notification that a write can be performed.

Specified by:
handleWrite in interface WriteObserver
Returns:
true there is still data to be written, otherwise false.
Throws:
IOException

write

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

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.