# Uses of Class
javax.sound.sampled.AudioFormat

Packages that use AudioFormat
Package
Description
javax.sound.sampled
Provides interfaces and classes for capture, processing, and playback of sampled audio data.
javax.sound.sampled.spi
Supplies abstract classes for service providers to subclass when offering new audio devices, sound file readers and writers, or audio format converters.

## Uses of AudioFormat in javax.sound.sampled

Fields in javax.sound.sampled declared as AudioFormat
Modifier and Type
Field
Description
`protected AudioFormat`
AudioInputStream.`format`
The format of the audio data contained in the stream.
Methods in javax.sound.sampled that return AudioFormat
Modifier and Type
Method
Description
`AudioFormat`
AudioFileFormat.`getFormat()`
Obtains the format of the audio data contained in the audio file.
`AudioFormat`
AudioInputStream.`getFormat()`
Obtains the audio format of the sound data in this audio input stream.
`AudioFormat`
DataLine.`getFormat()`
Obtains the current format (encoding, sample rate, number of channels, etc.) of the data line's audio data.
`AudioFormat[]`
DataLine.Info.`getFormats()`
Obtains a set of audio formats supported by the data line.
`static AudioFormat[]`
AudioSystem.`getTargetFormats(AudioFormat.Encoding targetEncoding, 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.
Methods in javax.sound.sampled with parameters of type AudioFormat
Modifier and Type
Method
Description
`static AudioInputStream`
AudioSystem.`getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream)`
Obtains an audio input stream of the indicated format, by converting the provided audio input stream.
`static SourceDataLine`
AudioSystem.`getSourceDataLine(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`
AudioSystem.`getSourceDataLine(AudioFormat format, 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 TargetDataLine`
AudioSystem.`getTargetDataLine(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`
AudioSystem.`getTargetDataLine(AudioFormat format, 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[]`
AudioSystem.`getTargetEncodings(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[]`
AudioSystem.`getTargetFormats(AudioFormat.Encoding targetEncoding, 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 boolean`
AudioSystem.`isConversionSupported(AudioFormat.Encoding targetEncoding, 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`
AudioSystem.`isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat)`
Indicates whether an audio input stream of a specified format can be obtained from an audio input stream of another specified format.
`boolean`
DataLine.Info.`isFormatSupported(AudioFormat format)`
Indicates whether this data line supports a particular audio format.
`boolean`
AudioFormat.`matches(AudioFormat format)`
Indicates whether this format matches the one specified.
`void`
Clip.`open(AudioFormat format, byte[] data, int offset, int bufferSize)`
Opens the clip, meaning that it should acquire any required system resources and become operational.
`void`
SourceDataLine.`open(AudioFormat format)`
Opens the line with the specified format, causing the line to acquire any required system resources and become operational.
`void`
SourceDataLine.`open(AudioFormat format, int bufferSize)`
Opens the line with the specified format and suggested buffer size, causing the line to acquire any required system resources and become operational.
`void`
TargetDataLine.`open(AudioFormat format)`
Opens the line with the specified format, causing the line to acquire any required system resources and become operational.
`void`
TargetDataLine.`open(AudioFormat format, int bufferSize)`
Opens the line with the specified format and requested buffer size, causing the line to acquire any required system resources and become operational.
Constructors in javax.sound.sampled with parameters of type AudioFormat
Modifier
Constructor
Description
`protected`
`AudioFileFormat(AudioFileFormat.Type type, int byteLength, AudioFormat format, int frameLength)`
Constructs an audio file format object.
``
`AudioFileFormat(AudioFileFormat.Type type, AudioFormat format, int frameLength)`
Constructs an audio file format object.
``
`AudioFileFormat(AudioFileFormat.Type type, AudioFormat format, int frameLength, Map<String,Object> properties)`
Construct an audio file format object with a set of defined properties.
``
`AudioInputStream(InputStream stream, AudioFormat format, long length)`
Constructs an audio input stream that has the requested format and length in sample frames, using audio data from the specified input stream.
``
`Info(Class<?> lineClass, AudioFormat format)`
Constructs a data line's info object from the specified information, which includes a single audio format.
``
`Info(Class<?> lineClass, AudioFormat[] formats, int minBufferSize, int maxBufferSize)`
Constructs a data line's info object from the specified information, which includes a set of supported audio formats and a range for the buffer size.
``
`Info(Class<?> lineClass, AudioFormat format, int bufferSize)`
Constructs a data line's info object from the specified information, which includes a single audio format and a desired buffer size.

## Uses of AudioFormat in javax.sound.sampled.spi

Methods in javax.sound.sampled.spi that return AudioFormat
Modifier and Type
Method
Description
`abstract AudioFormat[]`
FormatConversionProvider.`getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat)`
Obtains the set of target formats with the encoding specified supported by the format converter.
Methods in javax.sound.sampled.spi with parameters of type AudioFormat
Modifier and Type
Method
Description
`abstract AudioInputStream`
FormatConversionProvider.`getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream)`
Obtains an audio input stream with the specified format from the given audio input stream.
`abstract AudioFormat.Encoding[]`
FormatConversionProvider.`getTargetEncodings(AudioFormat sourceFormat)`
Obtains the set of target format encodings supported by the format converter given a particular source format.
`abstract AudioFormat[]`
FormatConversionProvider.`getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat)`
Obtains the set of target formats with the encoding specified supported by the format converter.
`boolean`
FormatConversionProvider.`isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat)`
Indicates whether the format converter supports conversion to a particular encoding from a particular format.
`boolean`
FormatConversionProvider.`isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat)`
Indicates whether the format converter supports conversion to one particular format from another.