org.mule.providers.tcp.protocols
Class LengthProtocol

java.lang.Object
  extended byorg.mule.providers.tcp.protocols.LengthProtocol
All Implemented Interfaces:
TcpProtocol

public class LengthProtocol
extends Object
implements TcpProtocol

The LengthProtocol is an application level tcp protocol that can be used to transfer large amounts of data without risking some data to be loss. The protocol is defined by sending / reading an integer (the packet length) and then the data to be transfered.

Version:
$Revision: 3798 $
Author:
Guillaume Nodet

Constructor Summary
LengthProtocol()
           
 
Method Summary
 byte[] read(InputStream is)
          Reads the input stream and returns a whole message.
 void write(OutputStream os, byte[] data)
          Write the specified message to the output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LengthProtocol

public LengthProtocol()
Method Detail

read

public byte[] read(InputStream is)
            throws IOException
Description copied from interface: TcpProtocol
Reads the input stream and returns a whole message.

Specified by:
read in interface TcpProtocol
Parameters:
is - the input stream
Returns:
an array of byte containing a full message
Throws:
IOException - if an exception occurs

write

public void write(OutputStream os,
                  byte[] data)
           throws IOException
Description copied from interface: TcpProtocol
Write the specified message to the output stream.

Specified by:
write in interface TcpProtocol
Parameters:
os - the output stream to write to
data - the data to write
Throws:
IOException - if an exception occurs


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.