JavaTM 2 Platform
Std. Ed. v1.4.0

javax.sound.sampled
Class AudioFileFormat

java.lang.Object
  |
  +--javax.sound.sampled.AudioFileFormat

public class AudioFileFormat
extends Object

An instance of the AudioFileFormat class describes an audio file, including the file type, the file's length in bytes, the length in sample frames of the audio data contained in the file, and the format of the audio data.

The AudioSystem class includes methods for determining the format of an audio file, obtaining an audio input stream from an audio file, and writing an audio file from an audio input stream.

Since:
1.3
See Also:
AudioInputStream

Nested Class Summary
static class AudioFileFormat.Type
          An instance of the Type class represents one of the standard types of audio file.
 
Constructor Summary
  AudioFileFormat(AudioFileFormat.Type type, AudioFormat format, int frameLength)
          Constructs an audio file format object.
protected AudioFileFormat(AudioFileFormat.Type type, int byteLength, AudioFormat format, int frameLength)
          Constructs an audio file format object.
 
Method Summary
 int getByteLength()
          Obtains the size in bytes of the entire audio file (not just its audio data).
 AudioFormat getFormat()
          Obtains the format of the audio data contained in the audio file.
 int getFrameLength()
          Obtains the length of the audio data contained in the file, expressed in sample frames.
 AudioFileFormat.Type getType()
          Obtains the audio file type, such as WAVE or AU.
 String toString()
          Provides a string representation of the file format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AudioFileFormat

protected AudioFileFormat(AudioFileFormat.Type type,
                          int byteLength,
                          AudioFormat format,
                          int frameLength)
Constructs an audio file format object. This protected constructor is intended for use by providers of file-reading services when returning information about an audio file or about supported audio file formats.

Parameters:
type - the type of the audio file
byteLength - the length of the file in bytes, or AudioSystem.NOT_SPECIFIED
format - the format of the audio data contained in the file
frameLength - the audio data length in sample frames, or AudioSystem.NOT_SPECIFIED
See Also:
getType()

AudioFileFormat

public AudioFileFormat(AudioFileFormat.Type type,
                       AudioFormat format,
                       int frameLength)
Constructs an audio file format object. This public constructor may be used by applications to describe the properties of a requested audio file.

Parameters:
type - the type of the audio file
format - the format of the audio data contained in the file
frameLength - the audio data length in sample frames, or AudioSystem.NOT_SPECIFIED
Method Detail

getType

public AudioFileFormat.Type getType()
Obtains the audio file type, such as WAVE or AU.

Returns:
the audio file type
See Also:
AudioFileFormat.Type.WAVE, AudioFileFormat.Type.AU, AudioFileFormat.Type.AIFF, AudioFileFormat.Type.AIFC, AudioFileFormat.Type.SND

getByteLength

public int getByteLength()
Obtains the size in bytes of the entire audio file (not just its audio data).

Returns:
the audio file length in bytes
See Also:
AudioSystem.NOT_SPECIFIED

getFormat

public AudioFormat getFormat()
Obtains the format of the audio data contained in the audio file.

Returns:
the audio data format

getFrameLength

public int getFrameLength()
Obtains the length of the audio data contained in the file, expressed in sample frames.

Returns:
the number of sample frames of audio data in the file
See Also:
AudioSystem.NOT_SPECIFIED

toString

public String toString()
Provides a string representation of the file format.

Overrides:
toString in class Object
Returns:
the file format as a string

JavaTM 2 Platform
Std. Ed. v1.4.0

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.