01: /*
02: * Copyright (c) xsocket.org, 2006 - 2008. All rights reserved.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: * Please refer to the LGPL license at: http://www.gnu.org/copyleft/lesser.txt
19: * The latest copy of this software may be found on http://www.xsocket.org/
20: */
21: package org.xsocket.connection.spi;
22:
23: import java.io.IOException;
24: import java.nio.ByteBuffer;
25:
26: /**
27: * Call back interface to notify io events of the {@link IIoHandler}. The IIoHandler
28: * is responsible to notify the events in the occured order. <br><br>
29: *
30: *
31: *
32: * @author grro@xsocket.org
33: */
34: public interface IIoHandlerCallback {
35:
36: /**
37: * notifies that data has been read from the socket. <br><br>
38: *
39: * @param data the received data
40: *
41: */
42: public void onData(ByteBuffer[] data);
43:
44: /**
45: * notifies that the underlying connection has been established. <br>
46: *
47: */
48: public void onConnect();
49:
50: /**
51: * notifies that the underlying connection has been disconnected (closed).<br>
52: *
53: */
54: public void onDisconnect();
55:
56: /**
57: * notifies the idle time out has been occurred.<br>
58: *
59: */
60: public void onIdleTimeout();
61:
62: /**
63: * notifies the connection time out has been occurred.<br>
64: *
65: */
66: public void onConnectionTimeout();
67:
68: /**
69: * notifies that the connection has to be closed (connection is corrupt,
70: * selector has be closed, ...). This call back method will NOT be called in the case of
71: * idle or connection time out.<br><br>
72: *
73: */
74: public void onConnectionAbnormalTerminated();
75:
76: /**
77: * notifies that data has been written on the socket.<br><br>
78: *
79: * @param data the written data
80: */
81: public void onWritten(ByteBuffer data);
82:
83: /**
84: * notifies that an error has been occurred by writing data on the socket.<br><br>
85: *
86: * @param ioe ioException an io exception
87: * @param data the data, which has been tried to write
88: */
89: public void onWriteException(IOException ioException,
90: ByteBuffer data);
91: }
|