DirectProtocol (Mule ESB 2.2.1 API)
Keywords: org.mule.transport.tcp.protocols.DirectProtocol class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.

Field Summary
`protected int` | `bufferSize`
`protected static int` | `UNLIMITED`

Fields inherited from class org.mule.transport.tcp.protocols.AbstractByteProtocol
`EOF, NO_STREAM, STREAM_OK`

Constructor Summary
`DirectProtocol()`
`DirectProtocol(boolean streamOk, int bufferSize)`

Method Summary
`protected boolean` | `isRepeat(int len, int available)` Decide whether to repeat transfer.
`Object` | `read(InputStream is)` Reads the input stream and returns a whole message.
`Object` | `read(InputStream is, int limit)`
`protected int` | `remaining(int limit, int remain, int len)`

Methods inherited from class org.mule.transport.tcp.protocols.AbstractByteProtocol
`copy, copy, createResponse, nullEmptyArray, safeRead, safeRead, write, writeByteArray`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### UNLIMITED

    protected static final int UNLIMITED

See Also:
  Constant Field Values

### bufferSize

    protected int bufferSize

Constructor Detail

### DirectProtocol

    public DirectProtocol()

### DirectProtocol

    public DirectProtocol(boolean streamOk,
                          int bufferSize)

Method Detail

### 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.