Class QueueInputStream

java.lang.Object
java.io.InputStream
com.swiftmq.swiftlet.queue.QueueInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class QueueInputStream extends InputStream
A QueueInputStream is an input stream that is mapped to a queue. Together with a QueueOutputStream, it enables queue based streaming.
Author:
IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
See Also:
  • Constructor Details

    • QueueInputStream

      public QueueInputStream(QueueReceiver queueReceiver, long receiveTimeout, int windowSize)
      Constructs a new QueueInputStream. The queue receiver works as factory for transactions (every message read from the queue is wrapped in a single transaction). The receive timeout ensures that a receive doesn't block forever. If a timeout occurs, it will be turned into an IOException of the read() method. The window size specifies a backlog of messages to receive, if messages are out of sequence. If the size is reached and the stream is still out of sequence, an IOException will be thrown.
      Parameters:
      queueReceiver - receiver.
      receiveTimeout - timeout.
      windowSize - window size.
  • Method Details

    • getReceiveTimeout

      public long getReceiveTimeout()
      Returns the receive timeout.
      Returns:
      receive timeout.
    • setReceiveTimeout

      public void setReceiveTimeout(long receiveTimeout)
      Set recive timeout.
      Parameters:
      receiveTimeout - receive timeout.
    • getWindowSize

      public int getWindowSize()
      Returns the window size.
      Returns:
      window size.
    • setWindowSize

      public void setWindowSize(int windowSize)
      Sets the window size.
      Parameters:
      windowSize - window size.
    • getMsgPropNames

      public Enumeration getMsgPropNames() throws Exception
      Returns the names of the message properties.
      Returns:
      names.
      Throws:
      Exception - on error.
    • getMsgProp

      public Object getMsgProp(String key) throws Exception
      Returns a message property.
      Parameters:
      key - key.
      Returns:
      value.
      Throws:
      Exception - on error.
    • read

      public int read() throws IOException
      Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.
      Specified by:
      read in class InputStream
      Returns:
      the next byte of data, or -1 if the end of the stream is reached.
      Throws:
      IOException - if an I/O error occurs.
    • available

      public int available() throws IOException
      Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or or another thread.
      Overrides:
      available in class InputStream
      Returns:
      the number of bytes that can be read from this input stream without blocking.
      Throws:
      IOException - if an I/O error occurs.
    • close

      public void close() throws IOException
      Closes this input stream and releases any system resources associated with the stream.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream
      Throws:
      IOException - if an I/O error occurs.