org.xiph.speex.spi
Class SpeexAudioFileWriter

java.lang.Object
  extended byjavax.sound.sampled.spi.AudioFileWriter
      extended byorg.xiph.speex.spi.SpeexAudioFileWriter

public class SpeexAudioFileWriter
extends javax.sound.sampled.spi.AudioFileWriter

Provider for Speex audio file writing services. This implementation can write Speex audio files from an audio stream.

Version:
$Revision: 1.4 $
Author:
Marc Gimpel, Wimba S.A. (marc@wimba.com)

Field Summary
static javax.sound.sampled.AudioFileFormat.Type[] NO_FORMAT
           
static javax.sound.sampled.AudioFileFormat.Type[] SPEEX_FORMAT
           
 
Constructor Summary
SpeexAudioFileWriter()
           
 
Method Summary
 javax.sound.sampled.AudioFileFormat.Type[] getAudioFileTypes()
          Obtains the file types for which file writing support is provided by this audio file writer.
 javax.sound.sampled.AudioFileFormat.Type[] getAudioFileTypes(javax.sound.sampled.AudioInputStream stream)
          Obtains the file types that this audio file writer can write from the audio input stream specified.
 int write(javax.sound.sampled.AudioInputStream stream, javax.sound.sampled.AudioFileFormat.Type fileType, java.io.File out)
          Writes a stream of bytes representing an audio file of the file format indicated to the external file provided.
 int write(javax.sound.sampled.AudioInputStream stream, javax.sound.sampled.AudioFileFormat.Type fileType, java.io.OutputStream out)
          Writes a stream of bytes representing an audio file of the file type indicated to the output stream provided.
private  int write(javax.sound.sampled.AudioInputStream stream, java.io.OutputStream out)
          Writes a stream of bytes representing an audio file of the file type indicated to the output stream provided.
 
Methods inherited from class javax.sound.sampled.spi.AudioFileWriter
isFileTypeSupported, isFileTypeSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_FORMAT

public static final javax.sound.sampled.AudioFileFormat.Type[] NO_FORMAT

SPEEX_FORMAT

public static final javax.sound.sampled.AudioFileFormat.Type[] SPEEX_FORMAT
Constructor Detail

SpeexAudioFileWriter

public SpeexAudioFileWriter()
Method Detail

getAudioFileTypes

public javax.sound.sampled.AudioFileFormat.Type[] getAudioFileTypes()
Obtains the file types for which file writing support is provided by this audio file writer.

Returns:
array of file types. If no file types are supported, an array of length 0 is returned.

getAudioFileTypes

public javax.sound.sampled.AudioFileFormat.Type[] getAudioFileTypes(javax.sound.sampled.AudioInputStream stream)
Obtains the file types that this audio file writer can write from the audio input stream specified.

Parameters:
stream - - the audio input stream for which audio file type support is queried.
Returns:
array of file types. If no file types are supported, an array of length 0 is returned.

write

public int write(javax.sound.sampled.AudioInputStream stream,
                 javax.sound.sampled.AudioFileFormat.Type fileType,
                 java.io.OutputStream out)
          throws java.io.IOException
Writes a stream of bytes representing an audio file of the file type indicated to the output stream provided. Some file types require that the length be written into the file header, and cannot be written from start to finish unless the length is known in advance. An attempt to write such a file type will fail with an IOException if the length in the audio file format is AudioSystem.NOT_SPECIFIED.

Parameters:
stream - - the audio input stream containing audio data to be written to the output stream.
fileType - - file type to be written to the output stream.
out - - stream to which the file data should be written.
Returns:
the number of bytes written to the output stream.
Throws:
java.io.IOException - - if an I/O exception occurs.
java.lang.IllegalArgumentException - - if the file type is not supported by the system.
See Also:
AudioFileWriter.isFileTypeSupported(AudioFileFormat.Type, AudioInputStream), getAudioFileTypes()

write

public int write(javax.sound.sampled.AudioInputStream stream,
                 javax.sound.sampled.AudioFileFormat.Type fileType,
                 java.io.File out)
          throws java.io.IOException
Writes a stream of bytes representing an audio file of the file format indicated to the external file provided.

Parameters:
stream - - the audio input stream containing audio data to be written to the file.
fileType - - file type to be written to the file.
out - - external file to which the file data should be written.
Returns:
the number of bytes written to the file.
Throws:
java.io.IOException - - if an I/O exception occurs.
java.lang.IllegalArgumentException - - if the file format is not supported by the system
See Also:
AudioFileWriter.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type), getAudioFileTypes()

write

private int write(javax.sound.sampled.AudioInputStream stream,
                  java.io.OutputStream out)
           throws java.io.IOException
Writes a stream of bytes representing an audio file of the file type indicated to the output stream provided.

Parameters:
stream - - the audio input stream containing audio data to be written to the output stream.
out - - stream to which the file data should be written.
Returns:
the number of bytes written to the output stream.
Throws:
java.io.IOException - - if an I/O exception occurs.


Copyright © 1999-2004 Wimba S.A. All Rights Reserved.