Package com.swiftmq.net.protocol.smqp
Class SMQPOutputHandler
- java.lang.Object
-
- java.io.OutputStream
-
- com.swiftmq.net.protocol.ProtocolOutputHandler
-
- com.swiftmq.net.protocol.smqp.SMQPOutputHandler
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class SMQPOutputHandler extends ProtocolOutputHandler
A SMQPOutputHandler handles SMQP output.- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
-
-
Constructor Summary
Constructors Constructor Description SMQPOutputHandler()SMQPOutputHandler(int bufferSize, int extendSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddByte(byte b)Add a byte to the current chunk.protected voidaddBytes(byte[] b, int offset, int len)Adds a number of bytes to the current chunk.ProtocolOutputHandlercreate()Factory method to create a new ProtocolOutputHandler.ProtocolOutputHandlercreate(int bufferSize, int extendSize)Factory method to create a new ProtocolOutputHandler.protected byte[]getByteArray()Returns a reference to the byte array of the current chunk to transmit.intgetChunkCount()Returns the number of chunk the handler has stored.protected intgetLength()Returns the number of bytes to transmit, starting at the offset.protected intgetOffset()Returns the offset in the byte array of the current chunk where transmit should start.protected voidmarkChunkCompleted()Marks a chunk completed.protected voidsetBytesWritten(int written)Sets the number of bytes written from the OutputListener.java.lang.StringtoString()-
Methods inherited from class com.swiftmq.net.protocol.ProtocolOutputHandler
flush, invokeOutputListener, setOutputListener, write, write
-
-
-
-
Method Detail
-
create
public ProtocolOutputHandler create()
Description copied from class:ProtocolOutputHandlerFactory method to create a new ProtocolOutputHandler. For example, a RawOutputHandler returns a RawOutputHandler here.- Specified by:
createin classProtocolOutputHandler- Returns:
- new protocol input handler.
-
create
public ProtocolOutputHandler create(int bufferSize, int extendSize)
Description copied from class:ProtocolOutputHandlerFactory method to create a new ProtocolOutputHandler. For example, a RawOutputHandler returns a RawOutputHandler here.- Specified by:
createin classProtocolOutputHandler- Parameters:
bufferSize- initial buffer sizeextendSize- extend size- Returns:
- new protocol input handler.
-
getChunkCount
public int getChunkCount()
Description copied from class:ProtocolOutputHandlerReturns the number of chunk the handler has stored.- Specified by:
getChunkCountin classProtocolOutputHandler- Returns:
- number of chunks.
-
getByteArray
protected byte[] getByteArray()
Description copied from class:ProtocolOutputHandlerReturns a reference to the byte array of the current chunk to transmit. Called duringinvokeOutputListener().- Specified by:
getByteArrayin classProtocolOutputHandler- Returns:
- byte array.
-
getOffset
protected int getOffset()
Description copied from class:ProtocolOutputHandlerReturns the offset in the byte array of the current chunk where transmit should start. Called duringinvokeOutputListener().- Specified by:
getOffsetin classProtocolOutputHandler- Returns:
- offset.
-
getLength
protected int getLength()
Description copied from class:ProtocolOutputHandlerReturns the number of bytes to transmit, starting at the offset. Called duringinvokeOutputListener().- Specified by:
getLengthin classProtocolOutputHandler- Returns:
- length.
-
setBytesWritten
protected void setBytesWritten(int written)
Description copied from class:ProtocolOutputHandlerSets the number of bytes written from the OutputListener. This is the actual number of bytes written from the OutputListener to the network. The offset then must be set tooffset+writtenand the length tolength-written. If all bytes of the current chunk have been written, the chunk can be destroyed or marked for reuse.- Specified by:
setBytesWrittenin classProtocolOutputHandler- Parameters:
written- number of written bytes.
-
addByte
protected void addByte(byte b)
Description copied from class:ProtocolOutputHandlerAdd a byte to the current chunk. Called fromwrite(b).- Specified by:
addBytein classProtocolOutputHandler- Parameters:
b- byte.
-
addBytes
protected void addBytes(byte[] b, int offset, int len)Description copied from class:ProtocolOutputHandlerAdds a number of bytes to the current chunk. Called fromwrite(b[],offset,len).- Specified by:
addBytesin classProtocolOutputHandler- Parameters:
b- byte array.offset- offset.len- length.
-
markChunkCompleted
protected void markChunkCompleted()
Description copied from class:ProtocolOutputHandlerMarks a chunk completed. Called duringflush()If a protocol transmits byte streams with a length field in front, this is the place to determine the length.- Specified by:
markChunkCompletedin classProtocolOutputHandler
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-