Class QueueOutputStream

java.lang.Object
java.io.OutputStream
com.swiftmq.swiftlet.queue.QueueOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class QueueOutputStream extends OutputStream
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 Details

    • SEQNO

      public static String SEQNO
    • SIZE

      public static String SIZE
    • EOF

      public static String EOF
  • Constructor Details

    • 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, 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

      public void write(int b) throws IOException
      Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.
      Specified by:
      write in class OutputStream
      Parameters:
      b - the byte.
      Throws:
      IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
    • flush

      public void flush() throws IOException
      Flushes this output stream and forces any buffered output bytes to be written out.
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream
      Throws:
      IOException - if an I/O error occurs.
    • close

      public void close() throws IOException
      Closes this output stream and releases any system resources associated with this stream. A flush() is performed before closing. The queue sender remains open.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException - if an I/O error occurs.