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

public abstract Class FormatConversionProvider

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.media.sound.AlawCodec, com.sun.media.sound.AudioFloatFormatConverter, com.sun.media.sound.PCMtoPCMCodec, com.sun.media.sound.UlawCodec
Imports
java.util.Arrays, javax.sound.sampled.AudioFormat, .AudioInputStream

A format conversion provider provides format conversion services from one or more input formats to one or more output formats. Converters include codecs, which encode and/or decode audio data, as well as transcoders, etc. Format converters provide methods for determining what conversions are supported and for obtaining an audio stream from which converted data can be read.

The source format represents the format of the incoming audio data, which will be converted.

The target format represents the format of the processed, converted audio data. This is the format of the data that can be read from the stream returned by one of the getAudioInputStream methods.

Author
Kara Kytle
Since
1.3

Constructor Summary

AccessConstructor and Description
protected
FormatConversionProvider()

Constructor for subclasses to call.

Method Summary

Modifier and TypeMethod and Description
public abstract AudioInputStream

Returns:

stream from which processed data with the specified target encoding may be read
getAudioInputStream
(AudioFormat.Encoding
desired encoding of the stream after processing
targetEncoding
,
AudioInputStream
stream from which data to be processed should be read
sourceStream
)

Obtains an audio input stream with the specified encoding from the given audio input stream.

public abstract AudioInputStream

Returns:

stream from which processed data with the specified format may be read
getAudioInputStream
(AudioFormat
desired data format of the stream after processing
targetFormat
,
AudioInputStream
stream from which data to be processed should be read
sourceStream
)

Obtains an audio input stream with the specified format from the given audio input stream.

public abstract AudioFormat.Encoding[]

Returns:

array of source format encodings. If for some reason provider does not provide any conversion services, an array of length 0 is returned.
getSourceEncodings
()

Obtains the set of source format encodings from which format conversion services are provided by this provider.

public abstract AudioFormat.Encoding[]

Returns:

array of target format encodings. If for some reason provider does not provide any conversion services, an array of length 0 is returned.
getTargetEncodings
()

Obtains the set of target format encodings to which format conversion services are provided by this provider.

public abstract AudioFormat.Encoding[]

Returns:

array of supported target format encodings
getTargetEncodings
(AudioFormat
format of the incoming data
sourceFormat
)

Obtains the set of target format encodings supported by the format converter given a particular source format.

public abstract AudioFormat[]

Returns:

array of supported target formats
getTargetFormats
(AudioFormat.Encoding
desired encoding of the stream after processing
targetEncoding
,
AudioFormat
format of the incoming data
sourceFormat
)

Obtains the set of target formats with the encoding specified supported by the format converter.

public boolean

Returns:

true if the conversion is supported, otherwise false
isConversionSupported
(final AudioFormat.Encoding
desired encoding of the outgoing data
targetEncoding
,
final AudioFormat
format of the incoming data
sourceFormat
)

Indicates whether the format converter supports conversion to a particular encoding from a particular format.

public boolean

Returns:

true if the conversion is supported, otherwise false
isConversionSupported
(final AudioFormat
desired format of outgoing data
targetFormat
,
final AudioFormat
format of the incoming data
sourceFormat
)

Indicates whether the format converter supports conversion to one particular format from another.

public boolean

Returns:

true if the encoding is supported, otherwise false
isSourceEncodingSupported
(final AudioFormat.Encoding
the source format encoding for which support is queried
sourceEncoding
)

Indicates whether the format converter supports conversion from the specified source format encoding.

public boolean

Returns:

true if the encoding is supported, otherwise false
isTargetEncodingSupported
(final AudioFormat.Encoding
the target format encoding for which support is queried
targetEncoding
)

Indicates whether the format converter supports conversion to the specified target format encoding.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FormatConversionProviderback to summary
protected FormatConversionProvider()

Constructor for subclasses to call.

Method Detail

getAudioInputStreamback to summary
public abstract AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream)

Obtains an audio input stream with the specified encoding from the given audio input stream.

Parameters
targetEncoding:AudioFormat.Encoding

desired encoding of the stream after processing

sourceStream:AudioInputStream

stream from which data to be processed should be read

Returns:AudioInputStream

stream from which processed data with the specified target encoding may be read

Exceptions
IllegalArgumentException:
if the format combination supplied is not supported
NullPointerException:
if targetEncoding or sourceStream are null
getAudioInputStreamback to summary
public abstract AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream)

Obtains an audio input stream with the specified format from the given audio input stream.

Parameters
targetFormat:AudioFormat

desired data format of the stream after processing

sourceStream:AudioInputStream

stream from which data to be processed should be read

Returns:AudioInputStream

stream from which processed data with the specified format may be read

Exceptions
IllegalArgumentException:
if the format combination supplied is not supported
NullPointerException:
if targetFormat or sourceStream are null
getSourceEncodingsback to summary
public abstract AudioFormat.Encoding[] getSourceEncodings()

Obtains the set of source format encodings from which format conversion services are provided by this provider.

Returns:AudioFormat.Encoding[]

array of source format encodings. If for some reason provider does not provide any conversion services, an array of length 0 is returned.

getTargetEncodingsback to summary
public abstract AudioFormat.Encoding[] getTargetEncodings()

Obtains the set of target format encodings to which format conversion services are provided by this provider.

Returns:AudioFormat.Encoding[]

array of target format encodings. If for some reason provider does not provide any conversion services, an array of length 0 is returned.

getTargetEncodingsback to summary
public abstract AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat)

Obtains the set of target format encodings supported by the format converter given a particular source format. If no target format encodings are supported for this source format, an array of length 0 is returned.

Parameters
sourceFormat:AudioFormat

format of the incoming data

Returns:AudioFormat.Encoding[]

array of supported target format encodings

Exceptions
NullPointerException:
if sourceFormat is null
getTargetFormatsback to summary
public abstract AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat)

Obtains the set of target formats with the encoding specified supported by the format converter. If no target formats with the specified encoding are supported for this source format, an array of length 0 is returned.

Parameters
targetEncoding:AudioFormat.Encoding

desired encoding of the stream after processing

sourceFormat:AudioFormat

format of the incoming data

Returns:AudioFormat[]

array of supported target formats

Exceptions
NullPointerException:
if targetEncoding or sourceFormat are null
isConversionSupportedback to summary
public boolean isConversionSupported(final AudioFormat.Encoding targetEncoding, final AudioFormat sourceFormat)

Indicates whether the format converter supports conversion to a particular encoding from a particular format.

Parameters
targetEncoding:AudioFormat.Encoding

desired encoding of the outgoing data

sourceFormat:AudioFormat

format of the incoming data

Returns:boolean

true if the conversion is supported, otherwise false

Exceptions
NullPointerException:
if targetEncoding or sourceFormat are null
isConversionSupportedback to summary
public boolean isConversionSupported(final AudioFormat targetFormat, final AudioFormat sourceFormat)

Indicates whether the format converter supports conversion to one particular format from another.

Parameters
targetFormat:AudioFormat

desired format of outgoing data

sourceFormat:AudioFormat

format of the incoming data

Returns:boolean

true if the conversion is supported, otherwise false

Exceptions
NullPointerException:
if targetFormat or sourceFormat are null
isSourceEncodingSupportedback to summary
public boolean isSourceEncodingSupported(final AudioFormat.Encoding sourceEncoding)

Indicates whether the format converter supports conversion from the specified source format encoding.

Parameters
sourceEncoding:AudioFormat.Encoding

the source format encoding for which support is queried

Returns:boolean

true if the encoding is supported, otherwise false

Exceptions
NullPointerException:
if sourceEncoding is null
isTargetEncodingSupportedback to summary
public boolean isTargetEncodingSupported(final AudioFormat.Encoding targetEncoding)

Indicates whether the format converter supports conversion to the specified target format encoding.

Parameters
targetEncoding:AudioFormat.Encoding

the target format encoding for which support is queried

Returns:boolean

true if the encoding is supported, otherwise false

Exceptions
NullPointerException:
if targetEncoding is null