--- old/src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java 2016-08-12 17:01:23.000000000 +0300 +++ new/src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java 2016-08-12 17:01:23.000000000 +0300 @@ -33,7 +33,6 @@ import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; - /** * A-law encodes linear data, and decodes a-law data to linear data. * @@ -52,7 +51,7 @@ 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF}; /** - * Initializes the decode tables + * Initializes the decode tables. */ static { for (int i=0;i<256;i++) { @@ -83,10 +82,7 @@ super(alawEncodings, alawEncodings); } - // NEW CODE - - /** - */ + @Override public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat){ if( sourceFormat.getEncoding().equals( AudioFormat.Encoding.PCM_SIGNED )) { @@ -117,8 +113,7 @@ } } - /** - */ + @Override public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){ Objects.requireNonNull(sourceFormat); if( (targetEncoding.equals( AudioFormat.Encoding.PCM_SIGNED ) && sourceFormat.getEncoding().equals( AudioFormat.Encoding.ALAW)) || @@ -129,8 +124,7 @@ } } - /** - */ + @Override public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream){ AudioFormat sourceFormat = sourceStream.getFormat(); AudioFormat.Encoding sourceEncoding = sourceFormat.getEncoding(); @@ -169,9 +163,7 @@ return getConvertedStream(targetFormat, sourceStream); } - /** - * use old code... - */ + @Override public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream){ if (!isConversionSupported(targetFormat, sourceStream.getFormat())) throw new IllegalArgumentException("Unsupported conversion: " @@ -180,10 +172,6 @@ return getConvertedStream( targetFormat, sourceStream ); } - - // OLD CODE - - /** * Opens the codec with the specified parameters. * @param stream stream from which data to be processed should be read @@ -192,7 +180,6 @@ * @throws IllegalArgumentException if the format combination supplied is * not supported. */ - /* public AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) { */ private AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) { AudioInputStream cs = null; @@ -201,7 +188,7 @@ if( inputFormat.matches(outputFormat) ) { cs = stream; } else { - cs = (AudioInputStream) (new AlawCodecStream(stream, outputFormat)); + cs = new AlawCodecStream(stream, outputFormat); } return cs; @@ -214,7 +201,6 @@ * returns an array of length 0. * @return array of supported output formats. */ - /* public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */ private AudioFormat[] getOutputFormats(AudioFormat inputFormat) { @@ -343,18 +329,20 @@ * Note that this won't actually read anything; must read in * two-byte units. */ + @Override public int read() throws IOException { byte[] b = new byte[1]; return read(b, 0, b.length); } - + @Override public int read(byte[] b) throws IOException { return read(b, 0, b.length); } + @Override public int read(byte[] b, int off, int len) throws IOException { // don't read fractional frames