Package com.swiftmq.net.protocol.raw
Class RawInputHandler
java.lang.Object
com.swiftmq.net.protocol.raw.RawInputHandler
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate()
Factory method to create a new ProtocolInputHandler.void
createInputBuffer
(int initialSize, int ensureSize) Create the input buffer of the protocol handler.byte[]
Returns the protocol handler input buffer.Returns the protocol handler input buffer.int
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.toString()
-
Constructor Details
-
RawInputHandler
public RawInputHandler()
-
-
Method Details
-
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
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
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
-