@XmlHints(allowTopLevelDefinition=true) public class DirectProtocol extends AbstractByteProtocol
TcpProtocol that does nothing. The socket reads until no more bytes are
(momentarily) available (previously the transfer buffer also had to be full on the previous read, which made stronger
requirements on the underlying network). On slow networks EOFProtocol and LengthProtocol may be more reliable.
Writing simply writes the data into the socket.
| Modifier and Type | Field and Description |
|---|---|
protected int |
bufferSize |
protected static int |
UNLIMITED |
EOF, NO_MAX_LENGTH, NO_STREAM, objectSerializer, rethrowExceptionOnRead, STREAM_OK, streamOk| Constructor and Description |
|---|
DirectProtocol() |
DirectProtocol(boolean streamOk,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
consume(InputStream is,
int limit) |
protected boolean |
isRepeat(int len,
int available)
Decide whether to repeat transfer.
|
InputStream |
read(InputStream socketIs)
Reads the input stream and returns a whole message.
|
protected int |
remaining(int limit,
int remain,
int len) |
void |
write(OutputStream os,
Object data,
String encoding)
Write the specified message into the
OutputStream. |
copy, copy, nullIfEmptyArray, safeRead, safeRead, setObjectSerializer, writeByteArrayprotected static final int UNLIMITED
protected int bufferSize
public DirectProtocol()
public DirectProtocol(boolean streamOk,
int bufferSize)
public InputStream read(InputStream socketIs) throws IOException
socketIs - the input streamInputStream containing a full messageIOException - if an exception occursprotected byte[] consume(InputStream is, int limit) throws IOException
IOExceptionprotected int remaining(int limit,
int remain,
int len)
protected boolean isRepeat(int len,
int available)
len - Amount transferred last call (-1 on EOF or socket error)available - Amount availablepublic void write(OutputStream os, Object data, String encoding) throws IOException
TcpProtocolOutputStream.os - the OutputStream in which the data is going to be writtendata - data to be writtenencoding - in which the data will be serialized if its type is StringIOException - if an exception occursCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.