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.OutputStreamA 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 voidclose()Closes this output stream and releases any system resources associated with this stream.voidflush()Flushes this output stream and forces any buffered output bytes to be written out.intgetChunkSize()Returns the chunk size.voidsetChunkSize(int chunkSize)Set the chunk size for messages sent by this stream.voidsetDeliveryMode(int deliveryMode)Set the JMS delivery mode for messages sent by this stream.voidsetRespectFlowControl(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.voidwrite(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.IOExceptionWrites the specified byte to this output stream. The general contract forwriteis 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 ofbare ignored.- Specified by:
writein classjava.io.OutputStream- Parameters:
b- thebyte.- Throws:
java.io.IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the output stream has been closed.
-
flush
public void flush() throws java.io.IOExceptionFlushes this output stream and forces any buffered output bytes to be written out.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException- if an I/O error occurs.
-
close
public void close() throws java.io.IOExceptionCloses this output stream and releases any system resources associated with this stream. Aflush()is performed before closing. The queue sender remains open.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException- if an I/O error occurs.
-
-