Package com.swiftmq.net.protocol.raw
Class RawInputHandler
- java.lang.Object
-
- com.swiftmq.net.protocol.raw.RawInputHandler
-
- All Implemented Interfaces:
ProtocolInputHandler
public class RawInputHandler extends java.lang.Object implements ProtocolInputHandler
A RawInputHandler handles a raw byte stream and pass them to a chunk listener on every call toput()
.- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
-
-
Constructor Summary
Constructors Constructor Description RawInputHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProtocolInputHandler
create()
Factory method to create a new ProtocolInputHandler.void
createInputBuffer(int initialSize, int ensureSize)
Create the input buffer of the protocol handler.byte[]
getBuffer()
Returns the protocol handler input buffer.java.nio.ByteBuffer
getByteBuffer()
Returns the protocol handler input buffer.int
getOffset()
Returns the current offset of the input buffer.void
setBytesWritten(int written)
Set the number of bytes written into the buffer.void
setChunkListener(ChunkListener listener)
Set the ChunkListener.java.lang.String
toString()
-
-
-
Method Detail
-
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 interfaceProtocolInputHandler
- 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 interfaceProtocolInputHandler
- 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 theinitialSize
. Each timegetBuffer()
is called, the buffer must have a remaining size ofensureSize
.- Specified by:
createInputBuffer
in interfaceProtocolInputHandler
- Parameters:
initialSize
- initial sizeensureSize
- ensured size on each getBuffer call
-
getByteBuffer
public java.nio.ByteBuffer getByteBuffer()
Description copied from interface:ProtocolInputHandler
Returns the protocol handler input buffer.- Specified by:
getByteBuffer
in interfaceProtocolInputHandler
- Returns:
- buffer.
-
getBuffer
public byte[] getBuffer()
Description copied from interface:ProtocolInputHandler
Returns the protocol handler input buffer.- Specified by:
getBuffer
in interfaceProtocolInputHandler
- Returns:
- buffer.
-
getOffset
public int getOffset()
Description copied from interface:ProtocolInputHandler
Returns the current offset of the input buffer.- Specified by:
getOffset
in interfaceProtocolInputHandler
- 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 interfaceProtocolInputHandler
- Parameters:
written
- number of bytes written
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-