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, UNLIMITED
EOF, 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, remaining
copy, copy, createResponse, isRethrowExceptionOnRead, nullEmptyArray, safeRead, safeRead, setObjectSerializer, setRethrowExceptionOnRead, write
public static final int NO_MAX_LENGTH
public LengthProtocol()
public LengthProtocol(int maxMessageLength)
public Object read(InputStream is) throws IOException
TcpProtocol
read
in interface TcpProtocol
read
in class DirectProtocol
is
- the input streamIOException
- if an exception occursprotected void writeByteArray(OutputStream os, byte[] data) throws IOException
writeByteArray
in class AbstractByteProtocol
IOException
protected boolean isRepeat(int len, int available)
isRepeat
in class DirectProtocol
len
- Amount transferred last call (-1 on EOF or socket error)available
- Amount availablepublic int getMaxMessageLength()
public void setMaxMessageLength(int maxMessageLength)
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.