Package com.swiftmq.swiftlet.queue
Class QueueOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.swiftmq.swiftlet.queue.QueueOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class QueueOutputStream extends java.io.OutputStream
A QueueOutputStream is an output stream that is mapped to a queue. Together with aQueueInputStream
, it enables queue based streaming.- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
- See Also:
QueueInputStream
-
-
Constructor Summary
Constructors Constructor Description QueueOutputStream(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, java.util.Hashtable customMsgProp, int chunkSize)
Creates a new QueueOutputStream with a specific chunk size and custom message properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
getChunkSize()
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.
-
-
-
Constructor Detail
-
QueueOutputStream
public QueueOutputStream(QueueSender queueSender, QueueImpl destination)
Creates a new QueueOutputStream with the default chunk size of 1 KB.- Parameters:
queueSender
- queue sender.destination
- queue.
-
QueueOutputStream
public QueueOutputStream(QueueSender queueSender, QueueImpl destination, int chunkSize)
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, java.util.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 Detail
-
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
public void write(int b) throws java.io.IOException
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 classjava.io.OutputStream
- Parameters:
b
- thebyte
.- Throws:
java.io.IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the output stream has been closed.
-
flush
public void flush() throws java.io.IOException
Flushes this output stream and forces any buffered output bytes to be written out.- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
- Throws:
java.io.IOException
- if an I/O error occurs.
-
close
public void close() throws java.io.IOException
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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
- if an I/O error occurs.
-
-