This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.sound.sampled
class AudioFileFormat

java.lang.Object extended by javax.sound.sampled.AudioFileFormat

Most common way to construct:

File file = …;

AudioFileFormat aff = AudioSystem.getAudioFileFormat(file);

Based on 13 examples


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 {@link 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.

An AudioFileFormat object can include a set of properties. A property is a pair of key and value: the key is of type String, the associated property value is an arbitrary object. Properties specify additional informational meta data (like a author, copyright, or file duration). Properties are optional information, and file reader and file writer implementations are not required to provide or recognize properties.

The following table lists some common properties that should be used in implementations:

Property key Value type Description
"duration" {@link java.lang.Long Long} playback duration of the file in microseconds
"author" {@link java.lang.String String} name of the author of this file
"title" {@link java.lang.String String} title of this file
"copyright" {@link java.lang.String String} copyright message
"date" {@link java.util.Date Date} date of the recording or release
"comment" {@link java.lang.String String} an arbitrary text


Nested Class Summary
static class

           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.
 
AudioFileFormat(AudioFileFormat.Type type, AudioFormat format, int frameLength, Map properties)

          Construct an audio file format object with a set of defined properties.
protected
AudioFileFormat(AudioFileFormat.Type type, int byteLength, AudioFormat format, int frameLength)

          Constructs an audio file format object.
 
Method Summary
 int

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

          Obtains the format of the audio data contained in the audio file.
 int

          Obtains the length of the audio data contained in the file, expressed in sample frames.
 Object

          Obtain the property value specified by the key.
 AudioFileFormat.Type

          Obtains the audio file type, such as WAVE or AU.
 Map

          Obtain an unmodifiable map of properties.
 String

          Provides a string representation of the file format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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

AudioFileFormat

public AudioFileFormat(AudioFileFormat.Type type,
                       AudioFormat format,
                       int frameLength,
                       Map properties)
Construct an audio file format object with a set of defined properties. This public constructor may be used by applications to describe the properties of a requested audio file. The properties map will be copied to prevent any changes to it.

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
properties - a Map<String,Object> object with properties

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
Method Detail

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

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

getProperty

public Object getProperty(String key)
Obtain the property value specified by the key. The concept of properties is further explained in the {@link AudioFileFormat class description}.

If the specified property is not defined for a particular file format, this method returns null.

Parameters:
key - the key of the desired property
Returns:
the value of the property with the specified key, or null if the property does not exist.

getType

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

Returns:
the audio file type

properties

public Map properties()
Obtain an unmodifiable map of properties. The concept of properties is further explained in the {@link AudioFileFormat class description}.

Returns:
a Map<String,Object> object containing all properties. If no properties are recognized, an empty map is returned.

toString

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

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


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.