public class LengthProtocol extends DirectProtocol
Note that use of this protocol must be symmetric - both the sending and receiving connectors must use the same protocol.
| Modifier and Type | Field and Description |
|---|---|
static int |
NO_MAX_LENGTH |
bufferSize, UNLIMITEDEOF, NO_STREAM, STREAM_OK| Constructor and Description |
|---|
LengthProtocol() |
LengthProtocol(int maxMessageLength) |
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxMessageLength() |
protected boolean |
isRepeat(int len,
int available)
Read all four bytes for initial integer (limit is set in read)
|
Object |
read(InputStream is)
Reads the input stream and returns a whole message.
|
void |
setMaxMessageLength(int maxMessageLength) |
protected void |
writeByteArray(OutputStream os,
byte[] data) |
read, remainingcopy, copy, createResponse, nullEmptyArray, safeRead, safeRead, writepublic static final int NO_MAX_LENGTH
public LengthProtocol()
public LengthProtocol(int maxMessageLength)
public Object read(InputStream is) throws IOException
TcpProtocolread in interface TcpProtocolread in class DirectProtocolis - the input streamIOException - if an exception occursprotected void writeByteArray(OutputStream os, byte[] data) throws IOException
writeByteArray in class AbstractByteProtocolIOExceptionprotected boolean isRepeat(int len,
int available)
isRepeat in class DirectProtocollen - Amount transferred last call (-1 on EOF or socket error)available - Amount availablepublic int getMaxMessageLength()
public void setMaxMessageLength(int maxMessageLength)
Copyright © 2003-2012 MuleSource, Inc.. All Rights Reserved.