APIdia Launch Partner
Top Description Constructors Methods
javax.sound.sampled.spi

public abstract Class AudioFileReader

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.media.sound.SunFileReader
Imports
java.io.File, .IOException, .InputStream, java.net.URL, javax.sound.sampled.AudioFileFormat, .AudioInputStream, .UnsupportedAudioFileException

Provider for audio file reading services. Classes providing concrete implementations can parse the format information from one or more types of audio file, and can produce audio input streams from files of these types.
Author
Kara Kytle
Since
1.3

Constructor Summary

AccessConstructor and Description
protected
AudioFileReader()

Constructor for subclasses to call.

Method Summary

Modifier and TypeMethod and Description
public abstract AudioFileFormat

Returns:

an AudioFileFormat object describing the audio file format
getAudioFileFormat
(InputStream
the input stream from which file format information should be extracted
stream
)

Obtains the audio file format of the input stream provided.

public abstract AudioFileFormat

Returns:

an AudioFileFormat object describing the audio file format
getAudioFileFormat
(URL
the URL from which file format information should be extracted
url
)

Obtains the audio file format of the URL provided.

public abstract AudioFileFormat

Returns:

an AudioFileFormat object describing the audio file format
getAudioFileFormat
(File
the File from which file format information should be extracted
file
)

Obtains the audio file format of the File provided.

public abstract AudioInputStream

Returns:

an AudioInputStream object based on the audio file data contained in the input stream
getAudioInputStream
(InputStream
the input stream from which the AudioInputStream should be constructed
stream
)

Obtains an audio input stream from the input stream provided.

public abstract AudioInputStream

Returns:

an AudioInputStream object based on the audio file data pointed to by the URL
getAudioInputStream
(URL
the URL for which the AudioInputStream should be constructed
url
)

Obtains an audio input stream from the URL provided.

public abstract AudioInputStream

Returns:

an AudioInputStream object based on the audio file data pointed to by the File
getAudioInputStream
(File
the File for which the AudioInputStream should be constructed
file
)

Obtains an audio input stream from the File provided.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AudioFileReaderback to summary
protected AudioFileReader()

Constructor for subclasses to call.

Method Detail

getAudioFileFormatback to summary
public abstract AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException

Obtains the audio file format of the input stream provided. The stream must point to valid audio file data. In general, audio file readers may need to read some data from the stream before determining whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and reset the stream's read pointer to its original position. If the input stream does not support this, this method may fail with an IOException.

Parameters
stream:InputStream

the input stream from which file format information should be extracted

Returns:AudioFileFormat

an AudioFileFormat object describing the audio file format

Exceptions
UnsupportedAudioFileException:
if the stream does not point to valid audio file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if stream is null
See Also
InputStream#markSupported, InputStream#mark
getAudioFileFormatback to summary
public abstract AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException

Obtains the audio file format of the URL provided. The URL must point to valid audio file data.

Parameters
url:URL

the URL from which file format information should be extracted

Returns:AudioFileFormat

an AudioFileFormat object describing the audio file format

Exceptions
UnsupportedAudioFileException:
if the URL does not point to valid audio file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if url is null
getAudioFileFormatback to summary
public abstract AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException

Obtains the audio file format of the File provided. The File must point to valid audio file data.

Parameters
file:File

the File from which file format information should be extracted

Returns:AudioFileFormat

an AudioFileFormat object describing the audio file format

Exceptions
UnsupportedAudioFileException:
if the File does not point to valid audio file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if file is null
getAudioInputStreamback to summary
public abstract AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException

Obtains an audio input stream from the input stream provided. The stream must point to valid audio file data. In general, audio file readers may need to read some data from the stream before determining whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and reset the stream's read pointer to its original position. If the input stream does not support this, this method may fail with an IOException.

Parameters
stream:InputStream

the input stream from which the AudioInputStream should be constructed

Returns:AudioInputStream

an AudioInputStream object based on the audio file data contained in the input stream

Exceptions
UnsupportedAudioFileException:
if the stream does not point to valid audio file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if stream is null
See Also
InputStream#markSupported, InputStream#mark
getAudioInputStreamback to summary
public abstract AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException

Obtains an audio input stream from the URL provided. The URL must point to valid audio file data.

Parameters
url:URL

the URL for which the AudioInputStream should be constructed

Returns:AudioInputStream

an AudioInputStream object based on the audio file data pointed to by the URL

Exceptions
UnsupportedAudioFileException:
if the URL does not point to valid audio file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if url is null
getAudioInputStreamback to summary
public abstract AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException

Obtains an audio input stream from the File provided. The File must point to valid audio file data.

Parameters
file:File

the File for which the AudioInputStream should be constructed

Returns:AudioInputStream

an AudioInputStream object based on the audio file data pointed to by the File

Exceptions
UnsupportedAudioFileException:
if the File does not point to valid audio file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if file is null