java.lang.Object | |
↳ | javax.sound.sampled.AudioFileFormat |
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
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.
AudioSystem
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" | Long |
playback duration of the file in microseconds |
"author" | String |
name of the author of this file |
"title" | String |
title of this file |
"copyright" | String |
copyright message |
"date" | Date |
date of the recording or release |
"comment" | String |
an arbitrary text |
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AudioFileFormat.Type | An instance of the Type class represents one of the
standard types of audio file. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs an audio file format object.
| |||||||||||
Construct an audio file format object with a set of
defined properties.
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs an audio file format object.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Obtains the size in bytes of the entire audio file (not just its audio data).
| |||||||||||
Obtains the format of the audio data contained in the audio file.
| |||||||||||
Obtains the length of the audio data contained in the file, expressed in sample frames.
| |||||||||||
Obtain the property value specified by the key.
| |||||||||||
Obtains the audio file type, such as
WAVE or AU . | |||||||||||
Obtain an unmodifiable map of properties.
| |||||||||||
Provides a string representation of the file format.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Constructs an audio file format object. This public constructor may be used by applications to describe the properties of a requested audio file.
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
|
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.
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 |
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.
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 |
Obtains the size in bytes of the entire audio file (not just its audio data).
Obtains the format of the audio data contained in the audio file.
Obtains the length of the audio data contained in the file, expressed in sample frames.
Obtain the property value specified by the key.
The concept of properties is further explained in
the class description
.
If the specified property is not defined for a
particular file format, this method returns
null
.
key | the key of the desired property |
---|
null
if the property does not exist.Obtain an unmodifiable map of properties.
The concept of properties is further explained in
the class description
.
Map<String,Object>
object containing
all properties. If no properties are recognized, an empty map is
returned.Provides a string representation of the file format.