--- old/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java 2014-04-28 19:35:18.000000000 +0400 +++ new/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java 2014-04-28 19:35:18.000000000 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,63 +25,62 @@ package javax.sound.sampled.spi; -import java.io.InputStream; - import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; +import static javax.sound.sampled.AudioFormat.Encoding; + /** - * 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. + * 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 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. + * 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 {@code getAudioInputStream} methods. * * @author Kara Kytle * @since 1.3 */ public abstract class FormatConversionProvider { - - // NEW METHODS - /** - * Obtains the set of source format encodings from which format - * conversion services are provided by this provider. + * Obtains the set of source format encodings from which format conversion + * services are provided by this provider. + * * @return array of source format encodings. If for some reason provider - * does not provide any conversion services, an array of length 0 is - * returned. + * does not provide any conversion services, an array of length 0 is + * returned. */ - public abstract AudioFormat.Encoding[] getSourceEncodings(); - + public abstract Encoding[] getSourceEncodings(); /** - * Obtains the set of target format encodings to which format - * conversion services are provided by this provider. + * Obtains the set of target format encodings to which format conversion + * services are provided by this provider. + * * @return array of target format encodings. If for some reason provider - * does not provide any conversion services, an array of length 0 is - * returned. + * does not provide any conversion services, an array of length 0 is + * returned. */ - public abstract AudioFormat.Encoding[] getTargetEncodings(); - + public abstract Encoding[] getTargetEncodings(); /** * Indicates whether the format converter supports conversion from the * specified source format encoding. - * @param sourceEncoding the source format encoding for which support is queried - * @return true if the encoding is supported, otherwise false + * + * @param sourceEncoding the source format encoding for which support is + * queried + * @return {@code true} if the encoding is supported, otherwise + * {@code false} */ - public boolean isSourceEncodingSupported(AudioFormat.Encoding sourceEncoding){ + public boolean isSourceEncodingSupported(Encoding sourceEncoding) { - AudioFormat.Encoding sourceEncodings[] = getSourceEncodings(); + Encoding sourceEncodings[] = getSourceEncodings(); for(int i=0; itrue if the encoding is supported, otherwise false + * + * @param targetEncoding the target format encoding for which support is + * queried + * @return {@code true} if the encoding is supported, otherwise + * {@code false} */ - public boolean isTargetEncodingSupported(AudioFormat.Encoding targetEncoding){ + public boolean isTargetEncodingSupported(Encoding targetEncoding) { - AudioFormat.Encoding targetEncodings[] = getTargetEncodings(); + Encoding targetEncodings[] = getTargetEncodings(); for(int i=0; itrue if the conversion is supported, otherwise false + * Indicates whether the format converter supports conversion to a + * particular encoding from a particular format. + * + * @param targetEncoding desired encoding of the outgoing data + * @param sourceFormat format of the incoming data + * @return {@code true} if the conversion is supported, otherwise + * {@code false} */ - public boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){ + public boolean isConversionSupported(Encoding targetEncoding, + AudioFormat sourceFormat) { - AudioFormat.Encoding targetEncodings[] = getTargetEncodings(sourceFormat); + Encoding targetEncodings[] = getTargetEncodings(sourceFormat); for(int i=0; itrue if the conversion is supported, otherwise false + * + * @param targetFormat desired format of outgoing data + * @param sourceFormat format of the incoming data + * @return {@code true} if the conversion is supported, otherwise + * {@code false} */ - public boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat){ + public boolean isConversionSupported(AudioFormat targetFormat, + AudioFormat sourceFormat) { AudioFormat targetFormats[] = getTargetFormats( targetFormat.getEncoding(), sourceFormat ); @@ -173,28 +177,33 @@ return false; } - /** - * Obtains an audio input stream with the specified encoding from the given audio - * input stream. - * @param targetEncoding desired encoding of the stream after processing - * @param sourceStream stream from which data to be processed should be read - * @return stream from which processed data with the specified target encoding may be read + * Obtains an audio input stream with the specified encoding from the given + * audio input stream. + * + * @param targetEncoding desired encoding of the stream after processing + * @param sourceStream stream from which data to be processed should be + * read + * @return stream from which processed data with the specified target + * encoding may be read * @throws IllegalArgumentException if the format combination supplied is - * not supported. + * not supported. */ - public abstract AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream); - + public abstract AudioInputStream getAudioInputStream( + Encoding targetEncoding, AudioInputStream sourceStream); /** - * Obtains an audio input stream with the specified format from the given audio - * input stream. - * @param targetFormat desired data format of the stream after processing - * @param sourceStream stream from which data to be processed should be read - * @return stream from which processed data with the specified format may be read + * Obtains an audio input stream with the specified format from the given + * audio input stream. + * + * @param targetFormat desired data format of the stream after processing + * @param sourceStream stream from which data to be processed should be + * read + * @return stream from which processed data with the specified format may be + * read * @throws IllegalArgumentException if the format combination supplied is - * not supported. + * not supported. */ - public abstract AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream); - + public abstract AudioInputStream getAudioInputStream( + AudioFormat targetFormat, AudioInputStream sourceStream); }