javax.sound.sampled
Class AudioSystem

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.sound.sampled.AudioSystem

public class AudioSystem
extends Object sample code for java.lang.Object definition code for java.lang.Object

The AudioSystem class acts as the entry point to the sampled-audio system resources. This class lets you query and access the mixers that are installed on the system. AudioSystem includes a number of methods for converting audio data between different formats, and for translating between audio files and streams. It also provides a method for obtaining a Line sample code for javax.sound.sampled.Line definition code for javax.sound.sampled.Line directly from the AudioSystem without dealing explicitly with mixers.

Properties can be used to specify the default mixer for specific line types. Both system properties and a properties file are considered. In the Sun reference implementation, the properties file is "lib/sound.properties" in the JRE directory. If a property exists both as a system property and in the properties file, the system property takes precedence. If none is specified, a suitable default is chosen among the available devices. The syntax of the properties file is specified in Properties.load sample code for java.util.Properties.load(java.io.InputStream) definition code for java.util.Properties.load(java.io.InputStream) . The following table lists the available property keys and which methods consider them:

Property Key Interface Affected Method(s)
javax.sound.sampled.Clip Clip sample code for javax.sound.sampled.Clip definition code for javax.sound.sampled.Clip getLine(javax.sound.sampled.Line.Info) sample code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info) , getClip() sample code for javax.sound.sampled.AudioSystem.getClip() definition code for javax.sound.sampled.AudioSystem.getClip()
javax.sound.sampled.Port Port sample code for javax.sound.sampled.Port definition code for javax.sound.sampled.Port getLine(javax.sound.sampled.Line.Info) sample code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info)
javax.sound.sampled.SourceDataLine SourceDataLine sample code for javax.sound.sampled.SourceDataLine definition code for javax.sound.sampled.SourceDataLine getLine(javax.sound.sampled.Line.Info) sample code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info) , getSourceDataLine(javax.sound.sampled.AudioFormat) sample code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat)
javax.sound.sampled.TargetDataLine TargetDataLine sample code for javax.sound.sampled.TargetDataLine definition code for javax.sound.sampled.TargetDataLine getLine(javax.sound.sampled.Line.Info) sample code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info) , getTargetDataLine(javax.sound.sampled.AudioFormat) sample code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat)
The property value consists of the provider class name and the mixer name, separated by the hash mark ("#"). The provider class name is the fully-qualified name of a concrete mixer provider sample code for javax.sound.sampled.spi.MixerProvider definition code for javax.sound.sampled.spi.MixerProvider class. The mixer name is matched against the String returned by the getName method of Mixer.Info. Either the class name, or the mixer name may be omitted. If only the class name is specified, the trailing hash mark is optional.

If the provider class is specified, and it can be successully retrieved from the installed providers, the list of Mixer.Info objects is retrieved from the provider. Otherwise, or when these mixers do not provide a subsequent match, the list is retrieved from getMixerInfo() sample code for javax.sound.sampled.AudioSystem.getMixerInfo() definition code for javax.sound.sampled.AudioSystem.getMixerInfo() to contain all available Mixer.Info objects.

If a mixer name is specified, the resulting list of Mixer.Info objects is searched: the first one with a matching name, and whose Mixer provides the respective line interface, will be returned. If no matching Mixer.Info object is found, or the mixer name is not specified, the first mixer from the resulting list, which provides the respective line interface, will be returned. For example, the property javax.sound.sampled.Clip with a value "com.sun.media.sound.MixerProvider#SunClip" will have the following consequences when getLine is called requesting a Clip instance: if the class com.sun.media.sound.MixerProvider exists in the list of installed mixer providers, the first Clip from the first mixer with name "SunClip" will be returned. If it cannot be found, the first Clip from the first mixer of the specified provider will be returned, regardless of name. If there is none, the first Clip from the first Mixer with name "SunClip" in the list of all mixers (as returned by getMixerInfo) will be returned, or, if not found, the first Clip of the first Mixerthat can be found in the list of all mixers is returned. If that fails, too, an IllegalArgumentException is thrown.

Since:
1.3
See Also:
AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat , AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream , Mixer sample code for javax.sound.sampled.Mixer definition code for javax.sound.sampled.Mixer , Line sample code for javax.sound.sampled.Line definition code for javax.sound.sampled.Line , Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info

Field Summary
static int NOT_SPECIFIED sample code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED definition code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED
          An integer that stands for an unknown numeric value.
 
Method Summary
static AudioFileFormat sample code for javax.sound.sampled.AudioFileFormat definition code for javax.sound.sampled.AudioFileFormat getAudioFileFormat sample code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.io.File) definition code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.io.File) (File sample code for java.io.File definition code for java.io.File  file)
          Obtains the audio file format of the specified File.
static AudioFileFormat sample code for javax.sound.sampled.AudioFileFormat definition code for javax.sound.sampled.AudioFileFormat getAudioFileFormat sample code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.io.InputStream) definition code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.io.InputStream) (InputStream sample code for java.io.InputStream definition code for java.io.InputStream  stream)
          Obtains the audio file format of the provided input stream.
static AudioFileFormat sample code for javax.sound.sampled.AudioFileFormat definition code for javax.sound.sampled.AudioFileFormat getAudioFileFormat sample code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.net.URL) definition code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.net.URL) (URL sample code for java.net.URL definition code for java.net.URL  url)
          Obtains the audio file format of the specified URL.
static AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type [] getAudioFileTypes sample code for javax.sound.sampled.AudioSystem.getAudioFileTypes() definition code for javax.sound.sampled.AudioSystem.getAudioFileTypes() ()
          Obtains the file types for which file writing support is provided by the system.
static AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type [] getAudioFileTypes sample code for javax.sound.sampled.AudioSystem.getAudioFileTypes(javax.sound.sampled.AudioInputStream) definition code for javax.sound.sampled.AudioSystem.getAudioFileTypes(javax.sound.sampled.AudioInputStream) (AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  stream)
          Obtains the file types that the system can write from the audio input stream specified.
static AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream getAudioInputStream sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioInputStream) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioInputStream) (AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  targetEncoding, AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  sourceStream)
          Obtains an audio input stream of the indicated encoding, by converting the provided audio input stream.
static AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream getAudioInputStream sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioInputStream) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioInputStream) (AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  targetFormat, AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  sourceStream)
          Obtains an audio input stream of the indicated format, by converting the provided audio input stream.
static AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream getAudioInputStream sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.io.File) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.io.File) (File sample code for java.io.File definition code for java.io.File  file)
          Obtains an audio input stream from the provided File.
static AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream getAudioInputStream sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.io.InputStream) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.io.InputStream) (InputStream sample code for java.io.InputStream definition code for java.io.InputStream  stream)
          Obtains an audio input stream from the provided input stream.
static AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream getAudioInputStream sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.net.URL) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.net.URL) (URL sample code for java.net.URL definition code for java.net.URL  url)
          Obtains an audio input stream from the URL provided.
static Clip sample code for javax.sound.sampled.Clip definition code for javax.sound.sampled.Clip getClip sample code for javax.sound.sampled.AudioSystem.getClip() definition code for javax.sound.sampled.AudioSystem.getClip() ()
          Obtains a clip that can be used for playing back an audio file or an audio stream.
static Clip sample code for javax.sound.sampled.Clip definition code for javax.sound.sampled.Clip getClip sample code for javax.sound.sampled.AudioSystem.getClip(javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getClip(javax.sound.sampled.Mixer.Info) (Mixer.Info sample code for javax.sound.sampled.Mixer.Info definition code for javax.sound.sampled.Mixer.Info  mixerInfo)
          Obtains a clip from the specified mixer that can be used for playing back an audio file or an audio stream.
static Line sample code for javax.sound.sampled.Line definition code for javax.sound.sampled.Line getLine sample code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info) (Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info  info)
          Obtains a line that matches the description in the specified Line.Info object.
static Mixer sample code for javax.sound.sampled.Mixer definition code for javax.sound.sampled.Mixer getMixer sample code for javax.sound.sampled.AudioSystem.getMixer(javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getMixer(javax.sound.sampled.Mixer.Info) (Mixer.Info sample code for javax.sound.sampled.Mixer.Info definition code for javax.sound.sampled.Mixer.Info  info)
          Obtains the requested audio mixer.
static Mixer.Info sample code for javax.sound.sampled.Mixer.Info definition code for javax.sound.sampled.Mixer.Info [] getMixerInfo sample code for javax.sound.sampled.AudioSystem.getMixerInfo() definition code for javax.sound.sampled.AudioSystem.getMixerInfo() ()
          Obtains an array of mixer info objects that represents the set of audio mixers that are currently installed on the system.
static SourceDataLine sample code for javax.sound.sampled.SourceDataLine definition code for javax.sound.sampled.SourceDataLine getSourceDataLine sample code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat) (AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  format)
          Obtains a source data line that can be used for playing back audio data in the format specified by the AudioFormat object.
static SourceDataLine sample code for javax.sound.sampled.SourceDataLine definition code for javax.sound.sampled.SourceDataLine getSourceDataLine sample code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info) (AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  format, Mixer.Info sample code for javax.sound.sampled.Mixer.Info definition code for javax.sound.sampled.Mixer.Info  mixerinfo)
          Obtains a source data line that can be used for playing back audio data in the format specified by the AudioFormat object, provided by the mixer specified by the Mixer.Info object.
static Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info [] getSourceLineInfo sample code for javax.sound.sampled.AudioSystem.getSourceLineInfo(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.getSourceLineInfo(javax.sound.sampled.Line.Info) (Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info  info)
          Obtains information about all source lines of a particular type that are supported by the installed mixers.
static TargetDataLine sample code for javax.sound.sampled.TargetDataLine definition code for javax.sound.sampled.TargetDataLine getTargetDataLine sample code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat) (AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  format)
          Obtains a target data line that can be used for recording audio data in the format specified by the AudioFormat object.
static TargetDataLine sample code for javax.sound.sampled.TargetDataLine definition code for javax.sound.sampled.TargetDataLine getTargetDataLine sample code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info) (AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  format, Mixer.Info sample code for javax.sound.sampled.Mixer.Info definition code for javax.sound.sampled.Mixer.Info  mixerinfo)
          Obtains a target data line that can be used for recording audio data in the format specified by the AudioFormat object, provided by the mixer specified by the Mixer.Info object.
static AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding [] getTargetEncodings sample code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat.Encoding) definition code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat.Encoding) (AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  sourceEncoding)
          Obtains the encodings that the system can obtain from an audio input stream with the specified encoding using the set of installed format converters.
static AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding [] getTargetEncodings sample code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat) (AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  sourceFormat)
          Obtains the encodings that the system can obtain from an audio input stream with the specified format using the set of installed format converters.
static AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat [] getTargetFormats sample code for javax.sound.sampled.AudioSystem.getTargetFormats(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getTargetFormats(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) (AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  targetEncoding, AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  sourceFormat)
          Obtains the formats that have a particular encoding and that the system can obtain from a stream of the specified format using the set of installed format converters.
static Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info [] getTargetLineInfo sample code for javax.sound.sampled.AudioSystem.getTargetLineInfo(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.getTargetLineInfo(javax.sound.sampled.Line.Info) (Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info  info)
          Obtains information about all target lines of a particular type that are supported by the installed mixers.
static boolean isConversionSupported sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) (AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  targetEncoding, AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  sourceFormat)
          Indicates whether an audio input stream of the specified encoding can be obtained from an audio input stream that has the specified format.
static boolean isConversionSupported sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) (AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  targetFormat, AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  sourceFormat)
          Indicates whether an audio input stream of a specified format can be obtained from an audio input stream of another specified format.
static boolean isFileTypeSupported sample code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type) definition code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type) (AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type  fileType)
          Indicates whether file writing support for the specified file type is provided by the system.
static boolean isFileTypeSupported sample code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type, javax.sound.sampled.AudioInputStream) definition code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type, javax.sound.sampled.AudioInputStream) (AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type  fileType, AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  stream)
          Indicates whether an audio file of the specified file type can be written from the indicated audio input stream.
static boolean isLineSupported sample code for javax.sound.sampled.AudioSystem.isLineSupported(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.isLineSupported(javax.sound.sampled.Line.Info) (Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info  info)
          Indicates whether the system supports any lines that match the specified Line.Info object.
static int write sample code for javax.sound.sampled.AudioSystem.write(javax.sound.sampled.AudioInputStream, javax.sound.sampled.AudioFileFormat.Type, java.io.File) definition code for javax.sound.sampled.AudioSystem.write(javax.sound.sampled.AudioInputStream, javax.sound.sampled.AudioFileFormat.Type, java.io.File) (AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  stream, AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type  fileType, File sample code for java.io.File definition code for java.io.File  out)
          Writes a stream of bytes representing an audio file of the specified file type to the external file provided.
static int write sample code for javax.sound.sampled.AudioSystem.write(javax.sound.sampled.AudioInputStream, javax.sound.sampled.AudioFileFormat.Type, java.io.OutputStream) definition code for javax.sound.sampled.AudioSystem.write(javax.sound.sampled.AudioInputStream, javax.sound.sampled.AudioFileFormat.Type, java.io.OutputStream) (AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  stream, AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type  fileType, OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  out)
          Writes a stream of bytes representing an audio file of the specified file type to the output stream provided.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

NOT_SPECIFIED sample code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED

public static final int NOT_SPECIFIED
An integer that stands for an unknown numeric value. This value is appropriate only for signed quantities that do not normally take negative values. Examples include file sizes, frame sizes, buffer sizes, and sample rates. A number of Java Sound constructors accept a value of NOT_SPECIFIED for such parameters. Other methods may also accept or return this value, as documented.

See Also:
Constant Field Values
Method Detail

getMixerInfo sample code for javax.sound.sampled.AudioSystem.getMixerInfo() definition code for javax.sound.sampled.AudioSystem.getMixerInfo()

public static Mixer.Info sample code for javax.sound.sampled.Mixer.Info definition code for javax.sound.sampled.Mixer.Info [] getMixerInfo()
Obtains an array of mixer info objects that represents the set of audio mixers that are currently installed on the system.

Returns:
an array of info objects for the currently installed mixers. If no mixers are available on the system, an array of length 0 is returned.
See Also:
getMixer(javax.sound.sampled.Mixer.Info) sample code for javax.sound.sampled.AudioSystem.getMixer(javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getMixer(javax.sound.sampled.Mixer.Info)

getMixer sample code for javax.sound.sampled.AudioSystem.getMixer(javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getMixer(javax.sound.sampled.Mixer.Info)

public static Mixer sample code for javax.sound.sampled.Mixer definition code for javax.sound.sampled.Mixer  getMixer(Mixer.Info sample code for javax.sound.sampled.Mixer.Info definition code for javax.sound.sampled.Mixer.Info  info)
Obtains the requested audio mixer.

Parameters:
info - a Mixer.Info object representing the desired mixer, or null for the system default mixer
Returns:
the requested mixer
Throws:
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if the requested mixer is unavailable because of security restrictions
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the info object does not represent a mixer installed on the system
See Also:
getMixerInfo() sample code for javax.sound.sampled.AudioSystem.getMixerInfo() definition code for javax.sound.sampled.AudioSystem.getMixerInfo()

getSourceLineInfo sample code for javax.sound.sampled.AudioSystem.getSourceLineInfo(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.getSourceLineInfo(javax.sound.sampled.Line.Info)

public static Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info [] getSourceLineInfo(Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info  info)
Obtains information about all source lines of a particular type that are supported by the installed mixers.

Parameters:
info - a Line.Info object that specifies the kind of lines about which information is requested
Returns:
an array of Line.Info objects describing source lines matching the type requested. If no matching source lines are supported, an array of length 0 is returned.
See Also:
Mixer.getSourceLineInfo(Line.Info) sample code for javax.sound.sampled.Mixer.getSourceLineInfo(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.Mixer.getSourceLineInfo(javax.sound.sampled.Line.Info)

getTargetLineInfo sample code for javax.sound.sampled.AudioSystem.getTargetLineInfo(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.getTargetLineInfo(javax.sound.sampled.Line.Info)

public static Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info [] getTargetLineInfo(Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info  info)
Obtains information about all target lines of a particular type that are supported by the installed mixers.

Parameters:
info - a Line.Info object that specifies the kind of lines about which information is requested
Returns:
an array of Line.Info objects describing target lines matching the type requested. If no matching target lines are supported, an array of length 0 is returned.
See Also:
Mixer.getTargetLineInfo(Line.Info) sample code for javax.sound.sampled.Mixer.getTargetLineInfo(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.Mixer.getTargetLineInfo(javax.sound.sampled.Line.Info)

isLineSupported sample code for javax.sound.sampled.AudioSystem.isLineSupported(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.isLineSupported(javax.sound.sampled.Line.Info)

public static boolean isLineSupported(Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info  info)
Indicates whether the system supports any lines that match the specified Line.Info object. A line is supported if any installed mixer supports it.

Parameters:
info - a Line.Info object describing the line for which support is queried
Returns:
true if at least one matching line is supported, otherwise false
See Also:
Mixer.isLineSupported(Line.Info) sample code for javax.sound.sampled.Mixer.isLineSupported(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.Mixer.isLineSupported(javax.sound.sampled.Line.Info)

getLine sample code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info) definition code for javax.sound.sampled.AudioSystem.getLine(javax.sound.sampled.Line.Info)

public static Line sample code for javax.sound.sampled.Line definition code for javax.sound.sampled.Line  getLine(Line.Info sample code for javax.sound.sampled.Line.Info definition code for javax.sound.sampled.Line.Info  info)
                    throws LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException 
Obtains a line that matches the description in the specified Line.Info object.

If a DataLine is requested, and info is an instance of DataLine.Info specifying at least one fully qualified audio format, the last one will be used as the default format of the returned DataLine.

If system properties javax.sound.sampled.Clip, javax.sound.sampled.Port, javax.sound.sampled.SourceDataLine and javax.sound.sampled.TargetDataLine are defined or they are defined in the file "sound.properties", they are used to retrieve default lines. For details, refer to the class description sample code for javax.sound.sampled.AudioSystem definition code for javax.sound.sampled.AudioSystem . If the respective property is not set, or the mixer requested in the property is not installed or does not provide the requested line, all installed mixers are queried for the requested line type. A Line will be returned from the first mixer providing the requested line type.

Parameters:
info - a Line.Info object describing the desired kind of line
Returns:
a line of the requested kind
Throws:
LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException - if a matching line is not available due to resource restrictions
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if a matching line is not available due to security restrictions
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the system does not support at least one line matching the specified Line.Info object through any installed mixer

getClip sample code for javax.sound.sampled.AudioSystem.getClip() definition code for javax.sound.sampled.AudioSystem.getClip()

public static Clip sample code for javax.sound.sampled.Clip definition code for javax.sound.sampled.Clip  getClip()
                    throws LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException 
Obtains a clip that can be used for playing back an audio file or an audio stream. The returned clip will be provided by the default system mixer, or, if not possible, by any other mixer installed in the system that supports a Clip object.

The returned clip must be opened with the open(AudioFormat) or open(AudioInputStream) method.

This is a high-level method that uses getMixer and internally.

If the system property javax.sound.sampled.Clip is defined or it is defined in the file "sound.properties", it is used to retrieve the default clip. For details, refer to the class description sample code for javax.sound.sampled.AudioSystem definition code for javax.sound.sampled.AudioSystem .

Returns:
the desired clip object
Throws:
LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException - if a clip object is not available due to resource restrictions
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if a clip object is not available due to security restrictions
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the system does not support at least one clip instance through any installed mixer
Since:
1.5
See Also:
getClip(Mixer.Info) sample code for javax.sound.sampled.AudioSystem.getClip(javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getClip(javax.sound.sampled.Mixer.Info)

getClip sample code for javax.sound.sampled.AudioSystem.getClip(javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getClip(javax.sound.sampled.Mixer.Info)

public static Clip sample code for javax.sound.sampled.Clip definition code for javax.sound.sampled.Clip  getClip(Mixer.Info sample code for javax.sound.sampled.Mixer.Info definition code for javax.sound.sampled.Mixer.Info  mixerInfo)
                    throws LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException 
Obtains a clip from the specified mixer that can be used for playing back an audio file or an audio stream.

The returned clip must be opened with the open(AudioFormat) or open(AudioInputStream) method.

This is a high-level method that uses getMixer and internally.

Parameters:
mixerInfo - a Mixer.Info object representing the desired mixer, or null for the system default mixer
Returns:
a clip object from the specified mixer
Throws:
LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException - if a clip is not available from this mixer due to resource restrictions
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if a clip is not available from this mixer due to security restrictions
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the system does not support at least one clip through the specified mixer
Since:
1.5
See Also:
getClip() sample code for javax.sound.sampled.AudioSystem.getClip() definition code for javax.sound.sampled.AudioSystem.getClip()

getSourceDataLine sample code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat)

public static SourceDataLine sample code for javax.sound.sampled.SourceDataLine definition code for javax.sound.sampled.SourceDataLine  getSourceDataLine(AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  format)
                                        throws LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException 
Obtains a source data line that can be used for playing back audio data in the format specified by the AudioFormat object. The returned line will be provided by the default system mixer, or, if not possible, by any other mixer installed in the system that supports a matching SourceDataLine object.

The returned line should be opened with the open(AudioFormat) or open(AudioFormat, int) method.

This is a high-level method that uses getMixer and internally.

The returned SourceDataLine's default audio format will be initialized with format.

If the system property javax.sound.sampled.SourceDataLine is defined or it is defined in the file "sound.properties", it is used to retrieve the default source data line. For details, refer to the class description sample code for javax.sound.sampled.AudioSystem definition code for javax.sound.sampled.AudioSystem .

Parameters:
format - an AudioFormat object specifying the supported audio format of the returned line, or null for any audio format
Returns:
the desired SourceDataLine object
Throws:
LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException - if a matching source data line is not available due to resource restrictions
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if a matching source data line is not available due to security restrictions
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the system does not support at least one source data line supporting the specified audio format through any installed mixer
Since:
1.5
See Also:
getSourceDataLine(AudioFormat, Mixer.Info) sample code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info)

getSourceDataLine sample code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info)

public static SourceDataLine sample code for javax.sound.sampled.SourceDataLine definition code for javax.sound.sampled.SourceDataLine  getSourceDataLine(AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  format,
                                               Mixer.Info sample code for javax.sound.sampled.Mixer.Info definition code for javax.sound.sampled.Mixer.Info  mixerinfo)
                                        throws LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException 
Obtains a source data line that can be used for playing back audio data in the format specified by the AudioFormat object, provided by the mixer specified by the Mixer.Info object.

The returned line should be opened with the open(AudioFormat) or open(AudioFormat, int) method.

This is a high-level method that uses getMixer and internally.

The returned SourceDataLine's default audio format will be initialized with format.

Parameters:
format - an AudioFormat object specifying the supported audio format of the returned line, or null for any audio format
mixerinfo - a Mixer.Info object representing the desired mixer, or null for the system default mixer
Returns:
the desired SourceDataLine object
Throws:
LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException - if a matching source data line is not available from the specified mixer due to resource restrictions
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if a matching source data line is not available from the specified mixer due to security restrictions
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the specified mixer does not support at least one source data line supporting the specified audio format
Since:
1.5
See Also:
getSourceDataLine(AudioFormat) sample code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getSourceDataLine(javax.sound.sampled.AudioFormat)

getTargetDataLine sample code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat)

public static TargetDataLine sample code for javax.sound.sampled.TargetDataLine definition code for javax.sound.sampled.TargetDataLine  getTargetDataLine(AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  format)
                                        throws LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException 
Obtains a target data line that can be used for recording audio data in the format specified by the AudioFormat object. The returned line will be provided by the default system mixer, or, if not possible, by any other mixer installed in the system that supports a matching TargetDataLine object.

The returned line should be opened with the open(AudioFormat) or open(AudioFormat, int) method.

This is a high-level method that uses getMixer and internally.

The returned TargetDataLine's default audio format will be initialized with format.

Parameters:
format - an AudioFormat object specifying the supported audio format of the returned line, or null for any audio format
Returns:
the desired TargetDataLine object
Throws:
LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException - if a matching target data line is not available due to resource restrictions
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if a matching target data line is not available due to security restrictions
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the system does not support at least one target data line supporting the specified audio format through any installed mixer
Since:
1.5
See Also:
getTargetDataLine(AudioFormat, Mixer.Info) sample code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info) , AudioPermission sample code for javax.sound.sampled.AudioPermission definition code for javax.sound.sampled.AudioPermission

getTargetDataLine sample code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info) definition code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat, javax.sound.sampled.Mixer.Info)

public static TargetDataLine sample code for javax.sound.sampled.TargetDataLine definition code for javax.sound.sampled.TargetDataLine  getTargetDataLine(AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  format,
                                               Mixer.Info sample code for javax.sound.sampled.Mixer.Info definition code for javax.sound.sampled.Mixer.Info  mixerinfo)
                                        throws LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException 
Obtains a target data line that can be used for recording audio data in the format specified by the AudioFormat object, provided by the mixer specified by the Mixer.Info object.

The returned line should be opened with the open(AudioFormat) or open(AudioFormat, int) method.

This is a high-level method that uses getMixer and internally.

The returned TargetDataLine's default audio format will be initialized with format.

If the system property javax.sound.sampled.TargetDataLine is defined or it is defined in the file "sound.properties", it is used to retrieve the default target data line. For details, refer to the class description sample code for javax.sound.sampled.AudioSystem definition code for javax.sound.sampled.AudioSystem .

Parameters:
format - an AudioFormat object specifying the supported audio format of the returned line, or null for any audio format
mixerinfo - a Mixer.Info object representing the desired mixer, or null for the system default mixer
Returns:
the desired TargetDataLine object
Throws:
LineUnavailableException sample code for javax.sound.sampled.LineUnavailableException definition code for javax.sound.sampled.LineUnavailableException - if a matching target data line is not available from the specified mixer due to resource restrictions
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if a matching target data line is not available from the specified mixer due to security restrictions
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the specified mixer does not support at least one target data line supporting the specified audio format
Since:
1.5
See Also:
getTargetDataLine(AudioFormat) sample code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getTargetDataLine(javax.sound.sampled.AudioFormat) , AudioPermission sample code for javax.sound.sampled.AudioPermission definition code for javax.sound.sampled.AudioPermission

getTargetEncodings sample code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat.Encoding) definition code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat.Encoding)

public static AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding [] getTargetEncodings(AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  sourceEncoding)
Obtains the encodings that the system can obtain from an audio input stream with the specified encoding using the set of installed format converters.

Parameters:
sourceEncoding - the encoding for which conversion support is queried
Returns:
array of encodings. If sourceEncodingis not supported, an array of length 0 is returned. Otherwise, the array will have a length of at least 1, representing sourceEncoding (no conversion).

getTargetEncodings sample code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat)

public static AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding [] getTargetEncodings(AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  sourceFormat)
Obtains the encodings that the system can obtain from an audio input stream with the specified format using the set of installed format converters.

Parameters:
sourceFormat - the audio format for which conversion is queried
Returns:
array of encodings. If sourceFormatis not supported, an array of length 0 is returned. Otherwise, the array will have a length of at least 1, representing the encoding of sourceFormat (no conversion).

isConversionSupported sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat)

public static boolean isConversionSupported(AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  targetEncoding,
                                            AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  sourceFormat)
Indicates whether an audio input stream of the specified encoding can be obtained from an audio input stream that has the specified format.

Parameters:
targetEncoding - the desired encoding after conversion
sourceFormat - the audio format before conversion
Returns:
true if the conversion is supported, otherwise false

getAudioInputStream sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioInputStream) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioInputStream)

public static AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  getAudioInputStream(AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  targetEncoding,
                                                   AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  sourceStream)
Obtains an audio input stream of the indicated encoding, by converting the provided audio input stream.

Parameters:
targetEncoding - the desired encoding after conversion
sourceStream - the stream to be converted
Returns:
an audio input stream of the indicated encoding
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the conversion is not supported
See Also:
getTargetEncodings(AudioFormat.Encoding) sample code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat.Encoding) definition code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat.Encoding) , getTargetEncodings(AudioFormat) sample code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getTargetEncodings(javax.sound.sampled.AudioFormat) , isConversionSupported(AudioFormat.Encoding, AudioFormat) sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) , getAudioInputStream(AudioFormat, AudioInputStream) sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioInputStream) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioInputStream)

getTargetFormats sample code for javax.sound.sampled.AudioSystem.getTargetFormats(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getTargetFormats(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat)

public static AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat [] getTargetFormats(AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  targetEncoding,
                                             AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  sourceFormat)
Obtains the formats that have a particular encoding and that the system can obtain from a stream of the specified format using the set of installed format converters.

Parameters:
targetEncoding - the desired encoding after conversion
sourceFormat - the audio format before conversion
Returns:
array of formats. If no formats of the specified encoding are supported, an array of length 0 is returned.

isConversionSupported sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat)

public static boolean isConversionSupported(AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  targetFormat,
                                            AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  sourceFormat)
Indicates whether an audio input stream of a specified format can be obtained from an audio input stream of another specified format.

Parameters:
targetFormat - the desired audio format after conversion
sourceFormat - the audio format before conversion
Returns:
true if the conversion is supported, otherwise false

getAudioInputStream sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioInputStream) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioInputStream)

public static AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  getAudioInputStream(AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  targetFormat,
                                                   AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  sourceStream)
Obtains an audio input stream of the indicated format, by converting the provided audio input stream.

Parameters:
targetFormat - the desired audio format after conversion
sourceStream - the stream to be converted
Returns:
an audio input stream of the indicated format
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the conversion is not supported #see #getTargetEncodings(AudioFormat)
See Also:
getTargetFormats(AudioFormat.Encoding, AudioFormat) sample code for javax.sound.sampled.AudioSystem.getTargetFormats(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.getTargetFormats(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) , isConversionSupported(AudioFormat, AudioFormat) sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) , getAudioInputStream(AudioFormat.Encoding, AudioInputStream) sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioInputStream) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioInputStream)

getAudioFileFormat sample code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.io.InputStream) definition code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.io.InputStream)

public static AudioFileFormat sample code for javax.sound.sampled.AudioFileFormat definition code for javax.sound.sampled.AudioFileFormat  getAudioFileFormat(InputStream sample code for java.io.InputStream definition code for java.io.InputStream  stream)
                                          throws UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException ,
                                                 IOException sample code for java.io.IOException definition code for java.io.IOException 
Obtains the audio file format of the provided input stream. The stream must point to valid audio file data. The implementation of this method may require multiple parsers to examine the stream to determine whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and, if not, reset the stream's read pointer to its original position. If the input stream does not support these operations, this method may fail with an IOException.

Parameters:
stream - the input stream from which file format information should be extracted
Returns:
an AudioFileFormat object describing the stream's audio file format
Throws:
UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException - if the stream does not point to valid audio file data recognized by the system
IOException sample code for java.io.IOException definition code for java.io.IOException - if an input/output exception occurs
See Also:
InputStream.markSupported() sample code for java.io.InputStream.markSupported() definition code for java.io.InputStream.markSupported() , InputStream.mark(int) sample code for java.io.InputStream.mark(int) definition code for java.io.InputStream.mark(int)

getAudioFileFormat sample code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.net.URL) definition code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.net.URL)

public static AudioFileFormat sample code for javax.sound.sampled.AudioFileFormat definition code for javax.sound.sampled.AudioFileFormat  getAudioFileFormat(URL sample code for java.net.URL definition code for java.net.URL  url)
                                          throws UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException ,
                                                 IOException sample code for java.io.IOException definition code for java.io.IOException 
Obtains the audio file format of the specified URL. The URL must point to valid audio file data.

Parameters:
url - the URL from which file format information should be extracted
Returns:
an AudioFileFormat object describing the audio file format
Throws:
UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException - if the URL does not point to valid audio file data recognized by the system
IOException sample code for java.io.IOException definition code for java.io.IOException - if an input/output exception occurs

getAudioFileFormat sample code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.io.File) definition code for javax.sound.sampled.AudioSystem.getAudioFileFormat(java.io.File)

public static AudioFileFormat sample code for javax.sound.sampled.AudioFileFormat definition code for javax.sound.sampled.AudioFileFormat  getAudioFileFormat(File sample code for java.io.File definition code for java.io.File  file)
                                          throws UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException ,
                                                 IOException sample code for java.io.IOException definition code for java.io.IOException 
Obtains the audio file format of the specified File. The File must point to valid audio file data.

Parameters:
file - the File from which file format information should be extracted
Returns:
an AudioFileFormat object describing the audio file format
Throws:
UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException - if the File does not point to valid audio file data recognized by the system
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O exception occurs

getAudioInputStream sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.io.InputStream) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.io.InputStream)

public static AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  getAudioInputStream(InputStream sample code for java.io.InputStream definition code for java.io.InputStream  stream)
                                            throws UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException ,
                                                   IOException sample code for java.io.IOException definition code for java.io.IOException 
Obtains an audio input stream from the provided input stream. The stream must point to valid audio file data. The implementation of this method may require multiple parsers to examine the stream to determine whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and, if not, reset the stream's read pointer to its original position. If the input stream does not support these operation, this method may fail with an IOException.

Parameters:
stream - the input stream from which the AudioInputStream should be constructed
Returns:
an AudioInputStream object based on the audio file data contained in the input stream.
Throws:
UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException - if the stream does not point to valid audio file data recognized by the system
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O exception occurs
See Also:
InputStream.markSupported() sample code for java.io.InputStream.markSupported() definition code for java.io.InputStream.markSupported() , InputStream.mark(int) sample code for java.io.InputStream.mark(int) definition code for java.io.InputStream.mark(int)

getAudioInputStream sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.net.URL) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.net.URL)

public static AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  getAudioInputStream(URL sample code for java.net.URL definition code for java.net.URL  url)
                                            throws UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException ,
                                                   IOException sample code for java.io.IOException definition code for java.io.IOException 
Obtains an audio input stream from the URL provided. The URL must point to valid audio file data.

Parameters:
url - the URL for which the AudioInputStream should be constructed
Returns:
an AudioInputStream object based on the audio file data pointed to by the URL
Throws:
UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException - if the URL does not point to valid audio file data recognized by the system
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O exception occurs

getAudioInputStream sample code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.io.File) definition code for javax.sound.sampled.AudioSystem.getAudioInputStream(java.io.File)

public static AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  getAudioInputStream(File sample code for java.io.File definition code for java.io.File  file)
                                            throws UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException ,
                                                   IOException sample code for java.io.IOException definition code for java.io.IOException 
Obtains an audio input stream from the provided File. The File must point to valid audio file data.

Parameters:
file - the File for which the AudioInputStream should be constructed
Returns:
an AudioInputStream object based on the audio file data pointed to by the File
Throws:
UnsupportedAudioFileException sample code for javax.sound.sampled.UnsupportedAudioFileException definition code for javax.sound.sampled.UnsupportedAudioFileException - if the File does not point to valid audio file data recognized by the system
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O exception occurs

getAudioFileTypes sample code for javax.sound.sampled.AudioSystem.getAudioFileTypes() definition code for javax.sound.sampled.AudioSystem.getAudioFileTypes()

public static AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type [] getAudioFileTypes()
Obtains the file types for which file writing support is provided by the system.

Returns:
array of unique file types. If no file types are supported, an array of length 0 is returned.

isFileTypeSupported sample code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type) definition code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type)

public static boolean isFileTypeSupported(AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type  fileType)
Indicates whether file writing support for the specified file type is provided by the system.

Parameters:
fileType - the file type for which write capabilities are queried
Returns:
true if the file type is supported, otherwise false

getAudioFileTypes sample code for javax.sound.sampled.AudioSystem.getAudioFileTypes(javax.sound.sampled.AudioInputStream) definition code for javax.sound.sampled.AudioSystem.getAudioFileTypes(javax.sound.sampled.AudioInputStream)

public static AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type [] getAudioFileTypes(AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  stream)
Obtains the file types that the system can write from the audio input stream specified.

Parameters:
stream - the audio input stream for which audio file type support is queried
Returns:
array of file types. If no file types are supported, an array of length 0 is returned.

isFileTypeSupported sample code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type, javax.sound.sampled.AudioInputStream) definition code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type, javax.sound.sampled.AudioInputStream)

public static boolean isFileTypeSupported(AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type  fileType,
                                          AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  stream)
Indicates whether an audio file of the specified file type can be written from the indicated audio input stream.

Parameters:
fileType - the file type for which write capabilities are queried
stream - the stream for which file-writing support is queried
Returns:
true if the file type is supported for this audio input stream, otherwise false

write sample code for javax.sound.sampled.AudioSystem.write(javax.sound.sampled.AudioInputStream, javax.sound.sampled.AudioFileFormat.Type, java.io.OutputStream) definition code for javax.sound.sampled.AudioSystem.write(javax.sound.sampled.AudioInputStream, javax.sound.sampled.AudioFileFormat.Type, java.io.OutputStream)

public static int write(AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  stream,
                        AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type  fileType,
                        OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  out)
                 throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Writes a stream of bytes representing an audio file of the specified file type to the output stream provided. Some file types require that the length be written into the file header; such files cannot be written from start to finish unless the length is known in advance. An attempt to write a file of such a type will fail with an IOException if the length in the audio file type is AudioSystem.NOT_SPECIFIED.

Parameters:
stream - the audio input stream containing audio data to be written to the file
fileType - the kind of audio file to write
out - the stream to which the file data should be written
Returns:
the number of bytes written to the output stream
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if an input/output exception occurs
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the file type is not supported by the system
See Also:
isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type) sample code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type) definition code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type) , getAudioFileTypes() sample code for javax.sound.sampled.AudioSystem.getAudioFileTypes() definition code for javax.sound.sampled.AudioSystem.getAudioFileTypes()

write sample code for javax.sound.sampled.AudioSystem.write(javax.sound.sampled.AudioInputStream, javax.sound.sampled.AudioFileFormat.Type, java.io.File) definition code for javax.sound.sampled.AudioSystem.write(javax.sound.sampled.AudioInputStream, javax.sound.sampled.AudioFileFormat.Type, java.io.File)

public static int write(AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream  stream,
                        AudioFileFormat.Type sample code for javax.sound.sampled.AudioFileFormat.Type definition code for javax.sound.sampled.AudioFileFormat.Type  fileType,
                        File sample code for java.io.File definition code for java.io.File  out)
                 throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Writes a stream of bytes representing an audio file of the specified file type to the external file provided.

Parameters:
stream - the audio input stream containing audio data to be written to the file
fileType - the kind of audio file to write
out - the external file to which the file data should be written
Returns:
the number of bytes written to the file
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O exception occurs
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the file type is not supported by the system
See Also:
isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type) sample code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type) definition code for javax.sound.sampled.AudioSystem.isFileTypeSupported(javax.sound.sampled.AudioFileFormat.Type) , getAudioFileTypes() sample code for javax.sound.sampled.AudioSystem.getAudioFileTypes() definition code for javax.sound.sampled.AudioSystem.getAudioFileTypes()