|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.sound.sampled.AudioSystem
public class AudioSystem
This clas is the primary interface to the audio system. It contains a number of static methods which can be used to access this package's functionality.
| 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NOT_SPECIFIED
| Method Detail |
|---|
public static AudioFileFormat getAudioFileFormat(File f)
throws UnsupportedAudioFileException,
IOException
f - the file to check
UnsupportedAudioFileException - if the file's format is not
recognized
IOException - if there is an I/O error reading the file
public static AudioFileFormat getAudioFileFormat(InputStream is)
throws UnsupportedAudioFileException,
IOException
is - the input stream to check
UnsupportedAudioFileException - if the stream's format is not
recognized
IOException - if there is an I/O error reading the stream
public static AudioFileFormat getAudioFileFormat(URL url)
throws UnsupportedAudioFileException,
IOException
url - the URL to check
UnsupportedAudioFileException - if the URL's format is not
recognized
IOException - if there is an I/O error reading the URLpublic static AudioFileFormat.Type[] getAudioFileTypes()
public static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream ais)
ais - the audio input stream
public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targ,
AudioInputStream ais)
targ - the target encodingais - the original audio stream
IllegalArgumentException - if the conversion cannot be made
public static AudioInputStream getAudioInputStream(AudioFormat targ,
AudioInputStream ais)
targ - the target formatais - the original audio stream
IllegalArgumentException - if the conversion cannot be made
public static AudioInputStream getAudioInputStream(File f)
throws UnsupportedAudioFileException,
IOException
f - the file to read
UnsupportedAudioFileException - if the file's audio format is not
recognized
IOException - if there is an error while reading the file
public static AudioInputStream getAudioInputStream(InputStream is)
throws UnsupportedAudioFileException,
IOException
is - the input stream
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
public static AudioInputStream getAudioInputStream(URL url)
throws UnsupportedAudioFileException,
IOException
url - the URL
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
public static Clip getClip()
throws LineUnavailableException
LineUnavailableException - if a clip is not available for some
reason
SecurityException - if a clip cannot be made for security reasons
public static Clip getClip(Mixer.Info info)
throws LineUnavailableException
info - the mixer to use
LineUnavailableException - if a clip is not available for some
reason
SecurityException - if a clip cannot be made for security reasons
public static Line getLine(Line.Info info)
throws LineUnavailableException
info - description of the line
LineUnavailableException - if no provider supplies a matching linepublic static Mixer getMixer(Mixer.Info info)
info - description of the mixer
IllegalArgumentException - if no provider supplies a matching mixerpublic static Mixer.Info[] getMixerInfo()
public static SourceDataLine getSourceDataLine(AudioFormat fmt)
throws LineUnavailableException
fmt - the audio format
LineUnavailableException - if no source data line matching
this format is available
public static SourceDataLine getSourceDataLine(AudioFormat fmt,
Mixer.Info mixer)
throws LineUnavailableException
fmt - the audio format
LineUnavailableException - if no target data line matching
this format is availablepublic static Line.Info[] getSourceLineInfo(Line.Info info)
info - description of the lines to match
public static TargetDataLine getTargetDataLine(AudioFormat fmt)
throws LineUnavailableException
fmt - the format to match
LineUnavailableException - if no matching line was found
public static TargetDataLine getTargetDataLine(AudioFormat fmt,
Mixer.Info mixer)
throws LineUnavailableException
fmt - the audio formatmixer - the mixer description
LineUnavailableException - if no matching target data line was
foundpublic static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding source)
source - the source encodingpublic static AudioFormat.Encoding[] getTargetEncodings(AudioFormat source)
source - the source format
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding encoding,
AudioFormat sourceFmt)
encoding - the target encodingsourceFmt - the source formatpublic static Line.Info[] getTargetLineInfo(Line.Info info)
info - the line description
public static boolean isConversionSupported(AudioFormat.Encoding targ,
AudioFormat source)
targ - the target encodingsource - the source format
public static boolean isConversionSupported(AudioFormat targ,
AudioFormat source)
targ - the target formatsource - the source formatpublic static boolean isFileTypeSupported(AudioFileFormat.Type type)
type - the audio file format type
public static boolean isFileTypeSupported(AudioFileFormat.Type type,
AudioInputStream ais)
type - the audio file format typeais - the audio input streampublic static boolean isLineSupported(Line.Info info)
info - the line to match
public static int write(AudioInputStream ais,
AudioFileFormat.Type type,
File out)
throws IOException
ais - the audio input stream to writetype - the desired audio file format typeout - the file to write to
IOException - if an I/O error occurs while writing
IllegalArgumentException - if the file type is not supported
public static int write(AudioInputStream ais,
AudioFileFormat.Type type,
OutputStream os)
throws IOException
ais - the audio input stream to writetype - the desired audio file format typeos - the output stream to write to
IOException - if an I/O error occurs while writing
IllegalArgumentException - if the file type is not supported
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||