Class 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 a QueueInputStream, it enables queue based streaming.
    Author:
    IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
    See Also:
    QueueInputStream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String EOF  
      static java.lang.String SEQNO  
      static java.lang.String SIZE  
    • 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.
      • Methods inherited from class java.io.OutputStream

        nullOutputStream, write, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SEQNO

        public static java.lang.String SEQNO
      • SIZE

        public static java.lang.String SIZE
      • EOF

        public static java.lang.String EOF
    • 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 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 java.io.OutputStream
        Parameters:
        b - the byte.
        Throws:
        java.io.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 java.io.IOException
        Flushes this output stream and forces any buffered output bytes to be written out.
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.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. A flush() is performed before closing. The queue sender remains open.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
        Throws:
        java.io.IOException - if an I/O error occurs.