1 /* 2 * $Id: TcpProtocol.java 3798 2006-11-04 04:07:14Z aperepel $ 3 * -------------------------------------------------------------------------------------- 4 * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com 5 * 6 * The software in this package is published under the terms of the MuleSource MPL 7 * license, a copy of which has been included with this distribution in the 8 * LICENSE.txt file. 9 */ 10 11 package org.mule.providers.tcp; 12 13 import java.io.IOException; 14 import java.io.InputStream; 15 import java.io.OutputStream; 16 17 /** 18 * The TcpProtocol interface enables to plug different application level protocols on 19 * a TcpConnector. 20 * 21 * @author <a HREF="mailto:gnt@codehaus.org">Guillaume Nodet</a> 22 * @version $Revision: 3798 $ 23 */ 24 public interface TcpProtocol 25 { 26 27 /** 28 * Reads the input stream and returns a whole message. 29 * 30 * @param is the input stream 31 * @return an array of byte containing a full message 32 * @throws IOException if an exception occurs 33 */ 34 byte[] read(InputStream is) throws IOException; 35 36 /** 37 * Write the specified message to the output stream. 38 * 39 * @param os the output stream to write to 40 * @param data the data to write 41 * @throws IOException if an exception occurs 42 */ 43 void write(OutputStream os, byte[] data) throws IOException; 44 } 45