< prev index next >
src/java.desktop/share/classes/com/sun/media/sound/UlawCodec.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -45,11 +45,11 @@
/* Tables used for U-law decoding */
private static final byte[] ULAW_TABH = new byte[256];
private static final byte[] ULAW_TABL = new byte[256];
- private static final short seg_end[] = {
+ private static final short[] seg_end = {
0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF
};
/**
* Initializes the decode tables.
@@ -81,19 +81,19 @@
@Override
public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat){
if( AudioFormat.Encoding.PCM_SIGNED.equals(sourceFormat.getEncoding()) ) {
if( sourceFormat.getSampleSizeInBits() == 16 ) {
- AudioFormat.Encoding enc[] = new AudioFormat.Encoding[1];
+ AudioFormat.Encoding[] enc = new AudioFormat.Encoding[1];
enc[0] = AudioFormat.Encoding.ULAW;
return enc;
} else {
return new AudioFormat.Encoding[0];
}
} else if (AudioFormat.Encoding.ULAW.equals(sourceFormat.getEncoding())) {
if (sourceFormat.getSampleSizeInBits() == 8) {
- AudioFormat.Encoding enc[] = new AudioFormat.Encoding[1];
+ AudioFormat.Encoding[] enc = new AudioFormat.Encoding[1];
enc[0] = AudioFormat.Encoding.PCM_SIGNED;
return enc;
} else {
return new AudioFormat.Encoding[0];
}
@@ -232,22 +232,22 @@
}
private final class UlawCodecStream extends AudioInputStream {
private static final int tempBufferSize = 64;
- private byte tempBuffer [] = null;
+ private byte[] tempBuffer = null;
/**
* True to encode to u-law, false to decode to linear.
*/
boolean encode = false;
AudioFormat encodeFormat;
AudioFormat decodeFormat;
- byte tabByte1[] = null;
- byte tabByte2[] = null;
+ byte[] tabByte1 = null;
+ byte[] tabByte2 = null;
int highByte = 0;
int lowByte = 1;
UlawCodecStream(AudioInputStream stream, AudioFormat outputFormat) {
super(stream, outputFormat, AudioSystem.NOT_SPECIFIED);
@@ -303,11 +303,11 @@
/*
* $$jb 2/23/99
* Used to determine segment number in uLaw encoding
*/
- private short search(short val, short table[], short size) {
+ private short search(short val, short[] table, short size) {
for(short i = 0; i < size; i++) {
if (val <= table[i]) { return i; }
}
return size;
}
< prev index next >