net.i2p.client.streaming
Class MessageChannel

java.lang.Object
  extended by java.nio.channels.spi.AbstractInterruptibleChannel
      extended by java.nio.channels.SelectableChannel
          extended by net.i2p.client.streaming.MessageChannel
All Implemented Interfaces:
Closeable, Channel, InterruptibleChannel, ReadableByteChannel, WritableByteChannel

public class MessageChannel
extends SelectableChannel
implements ReadableByteChannel, WritableByteChannel

As this does not (yet) extend SocketChannel it cannot be returned by StandardSocket.getChannel(), until we implement an I2P SocketAddress class. Warning, this interface and implementation is preliminary and subject to change without notice.

Since:
0.8.9

Constructor Summary
MessageChannel(I2PSocket socket)
           
 
Method Summary
 Object blockingLock()
           
 SelectableChannel configureBlocking(boolean blocking)
           
protected  void implCloseChannel()
           
 boolean isBlocking()
           
 boolean isRegistered()
           
 SelectionKey keyFor(Selector arg0)
           
 SelectorProvider provider()
           
 int read(ByteBuffer buf)
           
 SelectionKey register(Selector sel, int ops, Object lock)
           
 int validOps()
           
 int write(ByteBuffer buf)
           
 
Methods inherited from class java.nio.channels.SelectableChannel
register
 
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 

Constructor Detail

MessageChannel

MessageChannel(I2PSocket socket)
Method Detail

provider

public SelectorProvider provider()
Specified by:
provider in class SelectableChannel

validOps

public int validOps()
Specified by:
validOps in class SelectableChannel

isRegistered

public boolean isRegistered()
Specified by:
isRegistered in class SelectableChannel

keyFor

public SelectionKey keyFor(Selector arg0)
Specified by:
keyFor in class SelectableChannel

register

public SelectionKey register(Selector sel,
                             int ops,
                             Object lock)
                      throws ClosedChannelException
Specified by:
register in class SelectableChannel
Throws:
ClosedChannelException

configureBlocking

public SelectableChannel configureBlocking(boolean blocking)
                                    throws IOException
Specified by:
configureBlocking in class SelectableChannel
Throws:
IOException

isBlocking

public boolean isBlocking()
Specified by:
isBlocking in class SelectableChannel

blockingLock

public Object blockingLock()
Specified by:
blockingLock in class SelectableChannel

implCloseChannel

protected void implCloseChannel()
                         throws IOException
Specified by:
implCloseChannel in class AbstractInterruptibleChannel
Throws:
IOException

read

public int read(ByteBuffer buf)
         throws IOException
Specified by:
read in interface ReadableByteChannel
Throws:
IOException

write

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