Class FormatConversionProvider
java.lang.Object
javax.sound.sampled.spi.FormatConversionProvider
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.
- Since:
- 1.3
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor for subclasses to call. -
Method Summary
Modifier and TypeMethodDescriptionabstract AudioInputStreamgetAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) Obtains an audio input stream with the specified encoding from the given audio input stream.abstract AudioInputStreamgetAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) Obtains an audio input stream with the specified format from the given audio input stream.abstract AudioFormat.Encoding[]Obtains the set of source format encodings from which format conversion services are provided by this provider.abstract AudioFormat.Encoding[]Obtains the set of target format encodings to which format conversion services are provided by this provider.abstract AudioFormat.Encoding[]getTargetEncodings(AudioFormat sourceFormat) Obtains the set of target format encodings supported by the format converter given a particular source format.abstract AudioFormat[]getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) Obtains the set of target formats with the encoding specified supported by the format converter.booleanisConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) Indicates whether the format converter supports conversion to a particular encoding from a particular format.booleanisConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat) Indicates whether the format converter supports conversion to one particular format from another.booleanisSourceEncodingSupported(AudioFormat.Encoding sourceEncoding) Indicates whether the format converter supports conversion from the specified source format encoding.booleanisTargetEncodingSupported(AudioFormat.Encoding targetEncoding) Indicates whether the format converter supports conversion to the specified target format encoding.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
FormatConversionProvider
protected FormatConversionProvider()Constructor for subclasses to call.
-
-
Method Details
-
getSourceEncodings
Obtains the set of source format encodings from which format conversion services are provided by this provider.- Returns:
- array of source 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.- Returns:
- array of target format encodings. If for some reason provider does not provide any conversion services, an array of length 0 is returned.
-
isSourceEncodingSupported
Indicates whether the format converter supports conversion from the specified source format encoding.- Parameters:
sourceEncoding- the source format encoding for which support is queried- Returns:
trueif the encoding is supported, otherwisefalse- Throws:
NullPointerException- ifsourceEncodingisnull
-
isTargetEncodingSupported
Indicates whether the format converter supports conversion to the specified target format encoding.- Parameters:
targetEncoding- the target format encoding for which support is queried- Returns:
trueif the encoding is supported, otherwisefalse- Throws:
NullPointerException- iftargetEncodingisnull
-
getTargetEncodings
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- format of the incoming data- Returns:
- array of supported target format encodings
- Throws:
NullPointerException- ifsourceFormatisnull
-
isConversionSupported
Indicates whether the format converter supports conversion to a particular encoding from a particular format.- Parameters:
targetEncoding- desired encoding of the outgoing datasourceFormat- format of the incoming data- Returns:
trueif the conversion is supported, otherwisefalse- Throws:
NullPointerException- iftargetEncodingorsourceFormatarenull
-
getTargetFormats
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- desired encoding of the stream after processingsourceFormat- format of the incoming data- Returns:
- array of supported target formats
- Throws:
NullPointerException- iftargetEncodingorsourceFormatarenull
-
isConversionSupported
Indicates whether the format converter supports conversion to one particular format from another.- Parameters:
targetFormat- desired format of outgoing datasourceFormat- format of the incoming data- Returns:
trueif the conversion is supported, otherwisefalse- Throws:
NullPointerException- iftargetFormatorsourceFormatarenull
-
getAudioInputStream
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- desired encoding of the stream after processingsourceStream- stream from which data to be processed should be read- Returns:
- stream from which processed data with the specified target encoding may be read
- Throws:
IllegalArgumentException- if the format combination supplied is not supportedNullPointerException- iftargetEncodingorsourceStreamarenull
-
getAudioInputStream
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- desired data format of the stream after processingsourceStream- stream from which data to be processed should be read- Returns:
- stream from which processed data with the specified format may be read
- Throws:
IllegalArgumentException- if the format combination supplied is not supportedNullPointerException- iftargetFormatorsourceStreamarenull
-