Package com.sun.speech.freetts
Class OutputQueue
- java.lang.Object
-
- com.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
Constructors Constructor Description OutputQueue()
Creates a queue with the default size.OutputQueue(int size)
Creates an OutputQueue with the given size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
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.
-
-