org.mule.transport.tcp.protocols
Class DirectProtocol
java.lang.Object
org.mule.transport.tcp.protocols.AbstractByteProtocol
org.mule.transport.tcp.protocols.DirectProtocol
- All Implemented Interfaces:
- TcpProtocol
- Direct Known Subclasses:
- EOFProtocol, LengthProtocol, MuleMessageDirectProtocol
public class DirectProtocol
- extends AbstractByteProtocol
The DirectProtocol class is an application level tcp protocol that does nothing.
The socket is read 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 to the socket.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UNLIMITED
protected static final int UNLIMITED
- See Also:
- Constant Field Values
bufferSize
protected int bufferSize
DirectProtocol
public DirectProtocol()
DirectProtocol
public DirectProtocol(boolean streamOk,
int bufferSize)
read
public Object read(InputStream is)
throws IOException
- Description copied from interface:
TcpProtocol
- Reads the input stream and returns a whole message.
- Parameters:
is
- the input stream
- Returns:
- an array of byte containing a full message
- Throws:
IOException
- if an exception occurs
read
public Object read(InputStream is,
int limit)
throws IOException
- Throws:
IOException
remaining
protected int remaining(int limit,
int remain,
int len)
isRepeat
protected boolean isRepeat(int len,
int available)
- Decide whether to repeat transfer. This implementation does so if
more data are available. Note that previously, while documented as such,
there was also the additional requirement that the previous transfer
completely used the transfer buffer.
- Parameters:
len
- Amount transferred last call (-1 on EOF or socket error)available
- Amount available
- Returns:
- true if the transfer should continue
Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.