com.sun.speech.freetts
Class OutputQueue

java.lang.Object
  extended bycom.sun.speech.freetts.OutputQueue

public class OutputQueue
extends java.lang.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 Summary
OutputQueue()
          Creates a queue with the default size.
OutputQueue(int size)
          Creates an OutputQueue with the given size.
 
Method Summary
 void close()
          Closes the queue.
 boolean isClosed()
          Determines if the queue is closed.
 Utterance pend()
          Blocks until there is an utterance in the queue.
 void post(Utterance utterance)
          Posts the given utterance to the queue.
 void removeAll()
          Removes all items from this OutputQueue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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:
java.lang.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.