public abstract class AbstractByteProtocol extends Object implements TcpProtocol
| Modifier and Type | Field and Description |
|---|---|
protected static int |
EOF |
protected static int |
NO_MAX_LENGTH |
static boolean |
NO_STREAM |
protected ObjectSerializer |
objectSerializer |
protected boolean |
rethrowExceptionOnRead
Indicates if the exception should be rethrown if there is a failure while reading
|
static boolean |
STREAM_OK |
protected boolean |
streamOk |
| Constructor and Description |
|---|
AbstractByteProtocol(boolean streamOk) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
copy(InputStream source,
byte[] buffer,
OutputStream dest)
Make a single transfer from source to dest via a byte array buffer
|
protected int |
copy(InputStream source,
byte[] buffer,
OutputStream dest,
int size)
Make a single transfer from source to dest via a byte array buffer
|
protected InputStream |
nullIfEmptyArray(byte[] bytes) |
protected int |
safeRead(InputStream is,
byte[] buffer) |
protected int |
safeRead(InputStream is,
byte[] buffer,
int size)
Manage non-blocking reads and handle errors
|
void |
setObjectSerializer(ObjectSerializer objectSerializer) |
protected void |
writeByteArray(OutputStream os,
byte[] data) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitread, writeprotected static final int EOF
protected static final int NO_MAX_LENGTH
public static final boolean STREAM_OK
protected final boolean streamOk
public static final boolean NO_STREAM
@Inject protected ObjectSerializer objectSerializer
@Parameter @Optional(defaultValue="false") protected boolean rethrowExceptionOnRead
protected void writeByteArray(OutputStream os, byte[] data) throws IOException
IOExceptionprotected int safeRead(InputStream is, byte[] buffer) throws IOException
IOExceptionprotected int safeRead(InputStream is, byte[] buffer, int size) throws IOException
is - The input stream to read frombuffer - The buffer to read intosize - The amount of data (upper bound) to readIOException - other than socket exceptionsprotected int copy(InputStream source, byte[] buffer, OutputStream dest) throws IOException
source - Source of databuffer - Buffer array for transferdest - Destination of dataIOException - On non-socket errorprotected int copy(InputStream source, byte[] buffer, OutputStream dest, int size) throws IOException
source - Source of databuffer - Buffer array for transferdest - Destination of datasize - The amount of data (upper bound) to readIOException - On non-socket errorpublic void setObjectSerializer(ObjectSerializer objectSerializer)
protected InputStream nullIfEmptyArray(byte[] bytes)
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.