com.speech4j.sound
Class AudioOutputStream

java.lang.Object
  |
  +--com.speech4j.sound.AudioOutputStream

public class AudioOutputStream
extends java.lang.Object

Audion output to a stream. Do not use this class for handling big amounts of audio data because it keeps all the data in memory until close(). Use AudioOutputFile instead.

Version:
$Revision
Author:
Pavel Vlasov

Constructor Summary
AudioOutputStream(java.io.OutputStream out, javax.sound.sampled.AudioFormat format)
          Creates AudioOutputStream
 
Method Summary
 void close()
          Closes output
 long length()
          Returns size of output.
 double time()
          Returns time length of output.
 void write(AudioBuffer buffer)
          Writes AudioBuffer performing format conversion if necessary.
 void write(javax.sound.sampled.AudioInputStream ais, int cnt)
          Writes cnt bytes from AudioInputStream performing format conversion if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioOutputStream

public AudioOutputStream(java.io.OutputStream out,
                         javax.sound.sampled.AudioFormat format)
                  throws java.io.FileNotFoundException,
                         java.io.IOException
Creates AudioOutputStream

Parameters:
out - OutputStream
format - AudioFormat
Throws:
java.io.FileNotFoundException
java.io.IOException
Method Detail

write

public void write(AudioBuffer buffer)
           throws java.io.IOException,
                  SoundException
Writes AudioBuffer performing format conversion if necessary.

Parameters:
buffer - Audio buffer
Throws:
java.io.IOException
SoundException

write

public void write(javax.sound.sampled.AudioInputStream ais,
                  int cnt)
           throws java.io.IOException,
                  SoundException
Writes cnt bytes from AudioInputStream performing format conversion if necessary.

Parameters:
ais - AudioInputStream
cnt - number of bytes to write
Throws:
java.io.IOException
SoundException

close

public void close()
           throws java.io.IOException
Closes output

Throws:
java.io.IOException

length

public long length()
            throws java.io.IOException
Returns size of output.

Returns:
size of output in bytes.
Throws:
java.io.IOException

time

public double time()
            throws java.io.IOException
Returns time length of output.

Returns:
length of output in seconds.
Throws:
java.io.IOException


Copyright © 2003 Pavel Vlasov. All Rights Reserved.