Class JStreamAudioListener

java.lang.Object
  |
  +--JStreamAudioListener
All Implemented Interfaces:
javax.speech.AudioListener, ElanAudioListener, java.util.EventListener

public class JStreamAudioListener
extends java.lang.Object
implements ElanAudioListener

a basic implementation of com.elantts.tts.jsapi.ElanAudioListener that writes received bytes in a java.io.OutputStream (for example a java.io.FileOutputStream).


Field Summary
protected  java.io.OutputStream mOutput
          The stream where sound will be write.
 
Constructor Summary
JStreamAudioListener()
           
 
Method Summary
 void close()
          close the target OutputStream
 int getFreeSpace()
          should return the available bytes count in the OutputStream.
 void open(java.io.OutputStream stream)
          register the target OutputStream.
 void write(byte[] signal, int off, int len)
          Writes the received bytes in the OutputStream registerd by open..
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mOutput

protected java.io.OutputStream mOutput
The stream where sound will be write.

Constructor Detail

JStreamAudioListener

public JStreamAudioListener()
Method Detail

getFreeSpace

public int getFreeSpace()
should return the available bytes count in the OutputStream. This sample implementation returns 0x00FFFFFF.

Specified by:
getFreeSpace in interface ElanAudioListener
Returns:
0x00FFFFFF

write

public void write(byte[] signal,
                  int off,
                  int len)
           throws javax.speech.AudioException
Writes the received bytes in the OutputStream registerd by open..

Specified by:
write in interface ElanAudioListener
Parameters:
signal - see com.elantts.tts.jsapi.ElanAudioListener definition.
off - see com.elantts.tts.jsapi.ElanAudioListener definition.
len - see com.elantts.tts.jsapi.ElanAudioListener definition.
Throws:
javax.speech.AudioException - see com.elantts.tts.jsapi.ElanAudioListener definition.

open

public void open(java.io.OutputStream stream)
register the target OutputStream.

Parameters:
stream - a valid oppened java.io.OutputStream

close

public void close()
           throws javax.speech.AudioException
close the target OutputStream

Throws:
javax.speech.AudioException - if cannot close.