javax.sound.sampled
public class AudioSystem extends Object
Since: 1.3
Field Summary | |
---|---|
static int | NOT_SPECIFIED
A constant which can be passed to a number of methods in this package,
to indicate an unspecified value. |
Method Summary | |
---|---|
static AudioFileFormat | getAudioFileFormat(File f)
Return the file format of a given File. |
static AudioFileFormat | getAudioFileFormat(InputStream is)
Return the file format of a given input stream. |
static AudioFileFormat | getAudioFileFormat(URL url)
Return the file format of a given URL. |
static AudioFileFormat.Type[] | getAudioFileTypes()
Return an array of all the supported AudioFileFormat types. |
static AudioFileFormat.Type[] | getAudioFileTypes(AudioInputStream ais)
Return an array of all the supported AudioFileFormat types which match the
given audio input stream |
static AudioInputStream | getAudioInputStream(AudioFormat.Encoding targ, AudioInputStream ais)
Given an audio input stream, this will try to create a new audio input
stream whose encoding matches the given target encoding. |
static AudioInputStream | getAudioInputStream(AudioFormat targ, AudioInputStream ais)
Given an audio input stream, this will try to create a new audio input
stream whose format matches the given target format. |
static AudioInputStream | getAudioInputStream(File f)
Return an audio input stream for the file. |
static AudioInputStream | getAudioInputStream(InputStream is)
Return an audio input stream given an input stream. |
static AudioInputStream | getAudioInputStream(URL url)
Return an audio input stream for the given URL. |
static Clip | getClip()
Return a new clip which can be used for playing back an audio stream. |
static Clip | getClip(Mixer.Info info)
Return a new clip which can be used for playing back an audio stream.
|
static Line | getLine(Line.Info info)
Return a line matching the provided description. |
static Mixer | getMixer(Mixer.Info info)
Return a mixer matching the provided description. |
static Mixer.Info[] | getMixerInfo()
Return an array of descriptions of all the mixers provided on the system. |
static SourceDataLine | getSourceDataLine(AudioFormat fmt)
Return a source data line matching the given audio format. |
static SourceDataLine | getSourceDataLine(AudioFormat fmt, Mixer.Info mixer)
Return a target data line matching the given audio format. |
static Line.Info[] | getSourceLineInfo(Line.Info info)
Return an array of descriptions of all the source lines matching
the given line description. |
static TargetDataLine | getTargetDataLine(AudioFormat fmt)
Find and return a target data line matching the given audio format. |
static TargetDataLine | getTargetDataLine(AudioFormat fmt, Mixer.Info mixer)
Return a target data line matching the given audio format and
mixer. |
static AudioFormat.Encoding[] | getTargetEncodings(AudioFormat.Encoding source)
Given a source encoding, return an array of all target encodings to which
data in this form can be converted. |
static AudioFormat.Encoding[] | getTargetEncodings(AudioFormat source)
Given a source format, return an array of all the target encodings to
which data in this format can be converted. |
static AudioFormat[] | getTargetFormats(AudioFormat.Encoding encoding, AudioFormat sourceFmt)
Given a target encoding and a source audio format, return an array of all
matching audio formats to which data in this source format can be converted. |
static Line.Info[] | getTargetLineInfo(Line.Info info)
Given a line description, return an array of descriptions of all
the matching target lines. |
static boolean | isConversionSupported(AudioFormat.Encoding targ, AudioFormat source)
Return true if the currently installed providers are able to
convert data from the given source format to the given target encoding. |
static boolean | isConversionSupported(AudioFormat targ, AudioFormat source)
Return true if the currently installed providers are able to convert
the given source format to the given target format. |
static boolean | isFileTypeSupported(AudioFileFormat.Type type)
Return true if the given audio file format is supported by one of
the providers installed on the system. |
static boolean | isFileTypeSupported(AudioFileFormat.Type type, AudioInputStream ais)
Return true if the given audio file format is supported for the
given audio input stream by one of the providers installed on the
system. |
static boolean | isLineSupported(Line.Info info)
Return true if some provider on the system supplies a line
matching the argument. |
static int | write(AudioInputStream ais, AudioFileFormat.Type type, File out)
Write an audio input stream to the given file, using the specified
audio file format. |
static int | write(AudioInputStream ais, AudioFileFormat.Type type, OutputStream os)
Write an audio input stream to the given output stream, using the
specified audio file format. |
Parameters: f the file to check
Returns: the format of the file
Throws: UnsupportedAudioFileException if the file's format is not recognized IOException if there is an I/O error reading the file
Parameters: is the input stream to check
Returns: the format of the stream
Throws: UnsupportedAudioFileException if the stream's format is not recognized IOException if there is an I/O error reading the stream
Parameters: url the URL to check
Returns: the format of the URL
Throws: UnsupportedAudioFileException if the URL's format is not recognized IOException if there is an I/O error reading the URL
Returns: an array of unique types
Parameters: ais the audio input stream
Returns: an array of unique types
Parameters: targ the target encoding ais the original audio stream
Returns: a new audio stream
Throws: IllegalArgumentException if the conversion cannot be made
Parameters: targ the target format ais the original audio stream
Returns: a new audio stream
Throws: IllegalArgumentException if the conversion cannot be made
Parameters: f the file to read
Returns: an audio input stream for the file
Throws: UnsupportedAudioFileException if the file's audio format is not recognized IOException if there is an error while reading the file
Parameters: is the input stream
Returns: an audio input stream
Throws: UnsupportedAudioFileException if the input stream's audio format is not supported by any of the installed providers IOException if there is an error while reading the input stream
Parameters: url the URL
Returns: an audio input stream
Throws: UnsupportedAudioFileException if the URL's audio format is not supported by any of the installed providers IOException if there is an error while reading the URL
Throws: LineUnavailableException if a clip is not available for some reason SecurityException if a clip cannot be made for security reasons
Since: 1.5
Parameters: info the mixer to use
Throws: LineUnavailableException if a clip is not available for some reason SecurityException if a clip cannot be made for security reasons
Since: 1.5
Parameters: info description of the line
Returns: the matching line
Throws: LineUnavailableException if no provider supplies a matching line
Parameters: info description of the mixer
Returns: the matching mixer
Throws: IllegalArgumentException if no provider supplies a matching mixer
Parameters: fmt the audio format
Throws: LineUnavailableException if no source data line matching this format is available
Since: 1.5
Parameters: fmt the audio format
Throws: LineUnavailableException if no target data line matching this format is available
Since: 1.5
Parameters: info description of the lines to match
Parameters: fmt the format to match
Throws: LineUnavailableException if no matching line was found
Since: 1.5
Parameters: fmt the audio format mixer the mixer description
Returns: a target data line
Throws: LineUnavailableException if no matching target data line was found
Since: 1.5
Parameters: source the source encoding
Parameters: source the source format
Parameters: encoding the target encoding sourceFmt the source format
Parameters: info the line description
Parameters: targ the target encoding source the source format
Parameters: targ the target format source the source format
Parameters: type the audio file format type
Parameters: type the audio file format type ais the audio input stream
Parameters: info the line to match
Parameters: ais the audio input stream to write type the desired audio file format type out the file to write to
Returns: the number of bytes written
Throws: IOException if an I/O error occurs while writing IllegalArgumentException if the file type is not supported
Parameters: ais the audio input stream to write type the desired audio file format type os the output stream to write to
Returns: the number of bytes written
Throws: IOException if an I/O error occurs while writing IllegalArgumentException if the file type is not supported