Package com.swiftmq.swiftlet.queue
Class QueueOutputStream
java.lang.Object
java.io.OutputStream
com.swiftmq.swiftlet.queue.QueueOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
A QueueOutputStream is an output stream that is mapped to a queue. Together with
a
QueueInputStream
, it enables queue based streaming.- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQueueOutputStream
(QueueSender queueSender, QueueImpl destination) Creates a new QueueOutputStream with the default chunk size of 1 KB.QueueOutputStream
(QueueSender queueSender, QueueImpl destination, int chunkSize) Creates a new QueueOutputStream with a specific chunk size.QueueOutputStream
(QueueSender queueSender, QueueImpl destination, Hashtable customMsgProp, int chunkSize) Creates a new QueueOutputStream with a specific chunk size and custom message properties. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this output stream and releases any system resources associated with this stream.void
flush()
Flushes this output stream and forces any buffered output bytes to be written out.int
Returns the chunk size.void
setChunkSize
(int chunkSize) Set the chunk size for messages sent by this stream.void
setDeliveryMode
(int deliveryMode) Set the JMS delivery mode for messages sent by this stream.void
setRespectFlowControl
(boolean respectFlowControl) Specifies whether this stream respects the flow control of the underlying queue or not, hence it waits on flush if there is a delay.void
write
(int b) Writes the specified byte to this output stream.Methods inherited from class java.io.OutputStream
nullOutputStream, write, write
-
Field Details
-
SEQNO
-
SIZE
-
EOF
-
-
Constructor Details
-
QueueOutputStream
Creates a new QueueOutputStream with the default chunk size of 1 KB.- Parameters:
queueSender
- queue sender.destination
- queue.
-
QueueOutputStream
Creates a new QueueOutputStream with a specific chunk size.- Parameters:
queueSender
- queue sender.destination
- queue.chunkSize
- chunk size.
-
QueueOutputStream
public QueueOutputStream(QueueSender queueSender, QueueImpl destination, Hashtable customMsgProp, int chunkSize) Creates a new QueueOutputStream with a specific chunk size and custom message properties. These properties are set for every message send by this stream.- Parameters:
queueSender
- queue sender.destination
- queue.customMsgProp
- message properties.chunkSize
- chunk size.
-
-
Method Details
-
setDeliveryMode
public void setDeliveryMode(int deliveryMode) Set the JMS delivery mode for messages sent by this stream. The default delivery mode is NON_PERSISTENT.- Parameters:
deliveryMode
- delivery mode.
-
setRespectFlowControl
public void setRespectFlowControl(boolean respectFlowControl) Specifies whether this stream respects the flow control of the underlying queue or not, hence it waits on flush if there is a delay. The default is true- Parameters:
respectFlowControl
- respect FlowControl.
-
getChunkSize
public int getChunkSize()Returns the chunk size.- Returns:
- chunk size.
-
setChunkSize
public void setChunkSize(int chunkSize) Set the chunk size for messages sent by this stream.- Parameters:
chunkSize
- chunk size.
-
write
Writes the specified byte to this output stream. The general contract forwrite
is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argumentb
. The 24 high-order bits ofb
are ignored.- Specified by:
write
in classOutputStream
- Parameters:
b
- thebyte
.- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the output stream has been closed.
-
flush
Flushes this output stream and forces any buffered output bytes to be written out.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
- if an I/O error occurs.
-
close
Closes this output stream and releases any system resources associated with this stream. Aflush()
is performed before closing. The queue sender remains open.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
- if an I/O error occurs.
-