Mercurial > hg > RemoteEditor > REPSessionManager
view rep/SelectableEditorChannel.java @ 105:9c97532b9851
*** empty log message ***
author | pin |
---|---|
date | Sat, 22 Dec 2007 21:22:36 +0900 |
parents | 2d4c2c19d2d0 |
children |
line wrap: on
line source
package rep; import java.io.IOException; import java.nio.channels.ClosedChannelException; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.nio.channels.spi.SelectorProvider; public class SelectableEditorChannel extends SelectableChannel{ private SocketChannel channel; private REPPacketSend repsend; private REPPacketReceive reprec; public SelectableEditorChannel(SocketChannel channel){ this.channel = channel; repsend = new REPPacketSend(channel); reprec = new REPPacketReceive(channel); } @Override public Object blockingLock() { return channel.blockingLock(); //return null; } @Override public SelectableChannel configureBlocking(boolean block) throws IOException { return channel.configureBlocking(block); //return null; } @Override public boolean isBlocking() { return channel.isBlocking(); } @Override public boolean isRegistered() { return channel.isRegistered(); } @Override public SelectionKey keyFor(Selector sel) { return channel.keyFor(sel); } @Override public SelectorProvider provider() { return channel.provider(); } @Override public SelectionKey register(Selector sel, int ops, Object att) throws ClosedChannelException { return channel.register(sel, ops, att); } @Override public int validOps() { return channel.validOps(); } @Override protected void implCloseChannel() throws IOException { } public void putPacket(REPCommand comm){ repsend.send(comm); } public REPCommand getPacket(){ REPCommand command = reprec.unpack(); return command; } //public void setIO(SocketChannel channel) { // repsend = new REPPacketSend(channel); // reprec = new REPPacketReceive(channel); //} }