view rep/EditorChannel.java @ 84:54334d83194a

*** empty log message ***
author pin
date Fri, 21 Dec 2007 16:03:04 +0900
parents 167694db4796
children
line wrap: on
line source

package rep;

import java.nio.channels.SocketChannel;
import java.nio.channels.spi.SelectorProvider;

public abstract class EditorChannel extends SocketChannel {

	private REPPacketSend repsend;
	private REPPacketReceive reprec;

	protected EditorChannel(SelectorProvider provider) {
		super(provider);
	}
	
	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);
	}
	
	public void setIO() {
		repsend = new REPPacketSend(this);
		reprec = new REPPacketReceive(this);
	}

}