Class RawInputHandler

java.lang.Object
com.swiftmq.net.protocol.raw.RawInputHandler
All Implemented Interfaces:
ProtocolInputHandler

public class RawInputHandler extends Object implements ProtocolInputHandler
A RawInputHandler handles a raw byte stream and pass them to a chunk listener on every call to put().
Author:
IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
  • Constructor Details

    • RawInputHandler

      public RawInputHandler()
  • Method Details

    • create

      public ProtocolInputHandler create()
      Description copied from interface: ProtocolInputHandler
      Factory method to create a new ProtocolInputHandler. For example, a RawInputHandler returns a RawInputHandler here.
      Specified by:
      create in interface ProtocolInputHandler
      Returns:
      new protocol input handler.
    • setChunkListener

      public void setChunkListener(ChunkListener listener)
      Description copied from interface: ProtocolInputHandler
      Set the ChunkListener. The ChunkListener is implemented by the Network Swiftlet and will be set from it.
      Specified by:
      setChunkListener in interface ProtocolInputHandler
      Parameters:
      listener - listener.
    • createInputBuffer

      public void createInputBuffer(int initialSize, int ensureSize)
      Description copied from interface: ProtocolInputHandler
      Create the input buffer of the protocol handler. The buffer must be created with the initialSize. Each time getBuffer() is called, the buffer must have a remaining size of ensureSize.
      Specified by:
      createInputBuffer in interface ProtocolInputHandler
      Parameters:
      initialSize - initial size
      ensureSize - ensured size on each getBuffer call
    • getByteBuffer

      public ByteBuffer getByteBuffer()
      Description copied from interface: ProtocolInputHandler
      Returns the protocol handler input buffer.
      Specified by:
      getByteBuffer in interface ProtocolInputHandler
      Returns:
      buffer.
    • getBuffer

      public byte[] getBuffer()
      Description copied from interface: ProtocolInputHandler
      Returns the protocol handler input buffer.
      Specified by:
      getBuffer in interface ProtocolInputHandler
      Returns:
      buffer.
    • getOffset

      public int getOffset()
      Description copied from interface: ProtocolInputHandler
      Returns the current offset of the input buffer.
      Specified by:
      getOffset in interface ProtocolInputHandler
      Returns:
      offset.
    • setBytesWritten

      public void setBytesWritten(int written)
      Description copied from interface: ProtocolInputHandler
      Set the number of bytes written into the buffer. Called from the Network Swiftlet after it has read bytes from sockets directly into the buffer+offset.
      Specified by:
      setBytesWritten in interface ProtocolInputHandler
      Parameters:
      written - number of bytes written
    • toString

      public String toString()
      Overrides:
      toString in class Object