1 /* 2 Copyright 2010 Ramon Servadei 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 package mirrormap.nio; 17 18 import mirrormap.lifecycle.ILifeCycle; 19 20 /** 21 * Encapsulates the end point of an I/O connection. An I/O connection has 2 end 22 * points. 23 * 24 * @author Ramon Servadei 25 */ 26 public interface IConnectionEndPoint extends ILifeCycle 27 { 28 /** 29 * Send the data to the other end point. This may not be a synchronous 30 * action; the implementation may queue the data. 31 * 32 * @param data 33 * the data to send 34 */ 35 void send(byte[] data); 36 37 /** 38 * Indicates if this connection was initiated from this end point. 39 * 40 * @return <code>true</code> if the connection was initiated from this end 41 * point, <code>false</code> otherwise. 42 */ 43 boolean isOutbound(); 44 45 /** 46 * The object handling the inbound data for the connection 47 * 48 * @return object handling the inbound data for the connection 49 */ 50 IConnectionEndPointReceiver getReceiver(); 51 }