All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.craft.atom.io.IoHandler Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package org.craft.atom.io;

import java.io.IOException;

/**
 * Handles I/O events fired by craft-atom-io series component.
 * 
 * @author mindwind
 * @version 1.0, Feb 20, 2013
 */
public interface IoHandler {

	/**
	 * Invoked when channel opened.
	 * 
	 * @param channel
	 */
	void channelOpened(Channel channel);

	/**
	 * Invoked when channel closed.
	 * 
	 * @param channel
	 */
	void channelClosed(Channel channel);
	
	
	/**
	 * Invoked when channel is idle, idle means there is no data transmission (read or write).
	 * 
	 * @param channel
	 */
	void channelIdle(Channel channel);
	
	/**
	 * Invoked when channel has read some bytes.
	 * 
	 * @param channel
	 * @param bytes
	 */
	void channelRead(Channel channel, byte[] bytes);
	
	/**
	 * Invoked when channel would flush out some bytes.
	 * 
	 * @param channel
	 * @param bytes
	 */
	void channelFlush(Channel channel, byte[] bytes);
	
	/**
	 * Invoked when channel has written some bytes.
	 * 
	 * @param channel
	 * @param bytes
	 */
	void channelWritten(Channel channel, byte[] bytes);
	
	/**
	 * Invoked when any exception is thrown. 
	 * If cause is an instance of {@link IOException} channel should be close.
	 * 
	 * @param channel
	 * @param cause
	 */
	void channelThrown(Channel channel, Throwable cause);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy