Java Code Examples for javax.sound.sampled.spi.FormatConversionProvider#getAudioInputStream()
The following examples show how to use
javax.sound.sampled.spi.FormatConversionProvider#getAudioInputStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AudioSystem.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 2
Source File: AudioSystem.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 3
Source File: AudioSystem.java From Java8CN with Apache License 2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 4
Source File: AudioSystem.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * @throws NullPointerException if {@code targetFormat} or * {@code sourceStream} are {@code null} * @see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List<FormatConversionProvider> codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 5
Source File: AudioSystem.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated encoding, by converting * the provided audio input stream. * * @param targetEncoding the desired encoding after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated encoding * @throws IllegalArgumentException if the conversion is not supported * @throws NullPointerException if {@code targetEncoding} or * {@code sourceStream} are {@code null} * @see #getTargetEncodings(AudioFormat.Encoding) * @see #getTargetEncodings(AudioFormat) * @see #isConversionSupported(AudioFormat.Encoding, AudioFormat) * @see #getAudioInputStream(AudioFormat, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) { Objects.requireNonNull(targetEncoding); Objects.requireNonNull(sourceStream); if (sourceStream.getFormat().getEncoding().equals(targetEncoding)) { return sourceStream; } List<FormatConversionProvider> codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = codecs.get(i); if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) { return codec.getAudioInputStream( targetEncoding, sourceStream ); } } // we ran out of options, throw an exception throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat()); }
Example 6
Source File: AudioSystem.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 7
Source File: AudioSystem.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 8
Source File: AudioSystem.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 9
Source File: AudioSystem.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 10
Source File: AudioSystem.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 11
Source File: AudioSystem.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 12
Source File: AudioSystem.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 13
Source File: AudioSystem.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Obtains an audio input stream of the indicated format, by converting the * provided audio input stream. * @param targetFormat the desired audio format after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated format * @throws IllegalArgumentException if the conversion is not supported * #see #getTargetEncodings(AudioFormat) * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat) * @see #isConversionSupported(AudioFormat, AudioFormat) * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { if (sourceStream.getFormat().matches(targetFormat)) { return sourceStream; } List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) { return codec.getAudioInputStream(targetFormat,sourceStream); } } // we ran out of options... throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat()); }
Example 14
Source File: AudioSystem.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Obtains an audio input stream of the indicated encoding, by converting the * provided audio input stream. * @param targetEncoding the desired encoding after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated encoding * @throws IllegalArgumentException if the conversion is not supported * @see #getTargetEncodings(AudioFormat.Encoding) * @see #getTargetEncodings(AudioFormat) * @see #isConversionSupported(AudioFormat.Encoding, AudioFormat) * @see #getAudioInputStream(AudioFormat, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) { List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) { return codec.getAudioInputStream( targetEncoding, sourceStream ); } } // we ran out of options, throw an exception throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat()); }
Example 15
Source File: AudioSystem.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Obtains an audio input stream of the indicated encoding, by converting the * provided audio input stream. * @param targetEncoding the desired encoding after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated encoding * @throws IllegalArgumentException if the conversion is not supported * @see #getTargetEncodings(AudioFormat.Encoding) * @see #getTargetEncodings(AudioFormat) * @see #isConversionSupported(AudioFormat.Encoding, AudioFormat) * @see #getAudioInputStream(AudioFormat, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) { List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) { return codec.getAudioInputStream( targetEncoding, sourceStream ); } } // we ran out of options, throw an exception throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat()); }
Example 16
Source File: AudioSystem.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Obtains an audio input stream of the indicated encoding, by converting the * provided audio input stream. * @param targetEncoding the desired encoding after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated encoding * @throws IllegalArgumentException if the conversion is not supported * @see #getTargetEncodings(AudioFormat.Encoding) * @see #getTargetEncodings(AudioFormat) * @see #isConversionSupported(AudioFormat.Encoding, AudioFormat) * @see #getAudioInputStream(AudioFormat, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) { List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) { return codec.getAudioInputStream( targetEncoding, sourceStream ); } } // we ran out of options, throw an exception throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat()); }
Example 17
Source File: AudioSystem.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Obtains an audio input stream of the indicated encoding, by converting the * provided audio input stream. * @param targetEncoding the desired encoding after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated encoding * @throws IllegalArgumentException if the conversion is not supported * @see #getTargetEncodings(AudioFormat.Encoding) * @see #getTargetEncodings(AudioFormat) * @see #isConversionSupported(AudioFormat.Encoding, AudioFormat) * @see #getAudioInputStream(AudioFormat, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) { List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) { return codec.getAudioInputStream( targetEncoding, sourceStream ); } } // we ran out of options, throw an exception throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat()); }
Example 18
Source File: AudioSystem.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Obtains an audio input stream of the indicated encoding, by converting the * provided audio input stream. * @param targetEncoding the desired encoding after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated encoding * @throws IllegalArgumentException if the conversion is not supported * @see #getTargetEncodings(AudioFormat.Encoding) * @see #getTargetEncodings(AudioFormat) * @see #isConversionSupported(AudioFormat.Encoding, AudioFormat) * @see #getAudioInputStream(AudioFormat, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) { List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) { return codec.getAudioInputStream( targetEncoding, sourceStream ); } } // we ran out of options, throw an exception throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat()); }
Example 19
Source File: AudioSystem.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Obtains an audio input stream of the indicated encoding, by converting the * provided audio input stream. * @param targetEncoding the desired encoding after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated encoding * @throws IllegalArgumentException if the conversion is not supported * @see #getTargetEncodings(AudioFormat.Encoding) * @see #getTargetEncodings(AudioFormat) * @see #isConversionSupported(AudioFormat.Encoding, AudioFormat) * @see #getAudioInputStream(AudioFormat, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) { List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) { return codec.getAudioInputStream( targetEncoding, sourceStream ); } } // we ran out of options, throw an exception throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat()); }
Example 20
Source File: AudioSystem.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Obtains an audio input stream of the indicated encoding, by converting the * provided audio input stream. * @param targetEncoding the desired encoding after conversion * @param sourceStream the stream to be converted * @return an audio input stream of the indicated encoding * @throws IllegalArgumentException if the conversion is not supported * @see #getTargetEncodings(AudioFormat.Encoding) * @see #getTargetEncodings(AudioFormat) * @see #isConversionSupported(AudioFormat.Encoding, AudioFormat) * @see #getAudioInputStream(AudioFormat, AudioInputStream) */ public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) { List codecs = getFormatConversionProviders(); for(int i = 0; i < codecs.size(); i++) { FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i); if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) { return codec.getAudioInputStream( targetEncoding, sourceStream ); } } // we ran out of options, throw an exception throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat()); }