Class OutputQueue

java.lang.Object
com.sun.speech.freetts.OutputQueue

public class OutputQueue extends Object
Manages a process queue for utterances. Utterances that are queued to a processor can be written via the post method. A processing thread can wait for an utterance to arrive via the pend method.
  • Constructor Details

    • OutputQueue

      public OutputQueue(int size)
      Creates an OutputQueue with the given size.
      Parameters:
      size - the size of the queue
    • OutputQueue

      public OutputQueue()
      Creates a queue with the default size.
  • Method Details

    • post

      public void post(Utterance utterance)
      Posts the given utterance to the queue. This call will block if the queue is full.
      Parameters:
      utterance - the utterance to post
      Throws:
      IllegalStateException - if the queue is closed
    • close

      public void close()
      Closes the queue.
    • isClosed

      public boolean isClosed()
      Determines if the queue is closed.
      Returns:
      true the queue is closed; otherwise false
    • pend

      public Utterance pend()
      Blocks until there is an utterance in the queue.
      Returns:
      the next utterance. On a close or interrupt, a null is returned.
    • removeAll

      public void removeAll()
      Removes all items from this OutputQueue.