Skip to content

Commit ab1ee1b

Browse files
committed
Use final where possible.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1429868 13f79535-47bb-0310-9956-ffa450edef68
1 parent c6ad7fb commit ab1ee1b

90 files changed

Lines changed: 1430 additions & 1430 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/org/apache/commons/codec/Charsets.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class Charsets {
7070
* A charset or null.
7171
* @return the given Charset or the default Charset if the given Charset is null
7272
*/
73-
public static Charset toCharset(Charset charset) {
73+
public static Charset toCharset(final Charset charset) {
7474
return charset == null ? Charset.defaultCharset() : charset;
7575
}
7676

@@ -83,7 +83,7 @@ public static Charset toCharset(Charset charset) {
8383
* @throws java.nio.charset.UnsupportedCharsetException
8484
* If the named charset is unavailable
8585
*/
86-
public static Charset toCharset(String charset) {
86+
public static Charset toCharset(final String charset) {
8787
return charset == null ? Charset.defaultCharset() : Charset.forName(charset);
8888
}
8989

src/main/java/org/apache/commons/codec/DecoderException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public DecoderException() {
4949
* @param message
5050
* The detail message which is saved for later retrieval by the {@link #getMessage()} method.
5151
*/
52-
public DecoderException(String message) {
52+
public DecoderException(final String message) {
5353
super(message);
5454
}
5555

@@ -66,7 +66,7 @@ public DecoderException(String message) {
6666
* value is permitted, and indicates that the cause is nonexistent or unknown.
6767
* @since 1.4
6868
*/
69-
public DecoderException(String message, Throwable cause) {
69+
public DecoderException(final String message, final Throwable cause) {
7070
super(message, cause);
7171
}
7272

@@ -80,7 +80,7 @@ public DecoderException(String message, Throwable cause) {
8080
* value is permitted, and indicates that the cause is nonexistent or unknown.
8181
* @since 1.4
8282
*/
83-
public DecoderException(Throwable cause) {
83+
public DecoderException(final Throwable cause) {
8484
super(cause);
8585
}
8686
}

src/main/java/org/apache/commons/codec/StringEncoderComparator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public StringEncoderComparator() {
5252
* @param stringEncoder
5353
* the StringEncoder used for comparisons.
5454
*/
55-
public StringEncoderComparator(StringEncoder stringEncoder) {
55+
public StringEncoderComparator(final StringEncoder stringEncoder) {
5656
this.stringEncoder = stringEncoder;
5757
}
5858

@@ -70,15 +70,15 @@ public StringEncoderComparator(StringEncoder stringEncoder) {
7070
* @see Comparable
7171
*/
7272
@Override
73-
public int compare(Object o1, Object o2) {
73+
public int compare(final Object o1, final Object o2) {
7474

7575
int compareCode = 0;
7676

7777
try {
78-
Comparable s1 = (Comparable) this.stringEncoder.encode(o1);
79-
Comparable s2 = (Comparable) this.stringEncoder.encode(o2);
78+
final Comparable s1 = (Comparable) this.stringEncoder.encode(o1);
79+
final Comparable s2 = (Comparable) this.stringEncoder.encode(o2);
8080
compareCode = s1.compareTo(s2);
81-
} catch (EncoderException ee) {
81+
} catch (final EncoderException ee) {
8282
compareCode = 0;
8383
}
8484
return compareCode;

src/main/java/org/apache/commons/codec/binary/Base32.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public Base32() {
166166
* </p>
167167
* @param useHex if {@code true} then use Base32 Hex alphabet
168168
*/
169-
public Base32(boolean useHex) {
169+
public Base32(final boolean useHex) {
170170
this(0, null, useHex);
171171
}
172172

@@ -181,7 +181,7 @@ public Base32(boolean useHex) {
181181
* 8). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when
182182
* decoding.
183183
*/
184-
public Base32(int lineLength) {
184+
public Base32(final int lineLength) {
185185
this(lineLength, CHUNK_SEPARATOR);
186186
}
187187

@@ -203,7 +203,7 @@ public Base32(int lineLength) {
203203
* @throws IllegalArgumentException
204204
* The provided lineSeparator included some Base32 characters. That's not going to work!
205205
*/
206-
public Base32(int lineLength, byte[] lineSeparator) {
206+
public Base32(final int lineLength, final byte[] lineSeparator) {
207207
this(lineLength, lineSeparator, false);
208208
}
209209

@@ -228,7 +228,7 @@ public Base32(int lineLength, byte[] lineSeparator) {
228228
* The provided lineSeparator included some Base32 characters. That's not going to work! Or the
229229
* lineLength > 0 and lineSeparator is null.
230230
*/
231-
public Base32(int lineLength, byte[] lineSeparator, boolean useHex) {
231+
public Base32(final int lineLength, final byte[] lineSeparator, final boolean useHex) {
232232
super(BYTES_PER_UNENCODED_BLOCK, BYTES_PER_ENCODED_BLOCK,
233233
lineLength,
234234
lineSeparator == null ? 0 : lineSeparator.length);
@@ -245,7 +245,7 @@ public Base32(int lineLength, byte[] lineSeparator, boolean useHex) {
245245
}
246246
// Must be done after initializing the tables
247247
if (containsAlphabetOrPad(lineSeparator)) {
248-
String sep = StringUtils.newStringUtf8(lineSeparator);
248+
final String sep = StringUtils.newStringUtf8(lineSeparator);
249249
throw new IllegalArgumentException("lineSeparator must not contain Base32 characters: [" + sep + "]");
250250
}
251251
this.encodeSize = BYTES_PER_ENCODED_BLOCK + lineSeparator.length;
@@ -281,7 +281,7 @@ public Base32(int lineLength, byte[] lineSeparator, boolean useHex) {
281281
* Output is written to {@link Context#buffer} as 8-bit octets, using {@link Context#pos} as the buffer position
282282
*/
283283
@Override
284-
void decode(byte[] in, int inPos, int inAvail, Context context) { // package protected for access from I/O streams
284+
void decode(final byte[] in, int inPos, final int inAvail, final Context context) { // package protected for access from I/O streams
285285
if (context.eof) {
286286
return;
287287
}
@@ -375,7 +375,7 @@ void decode(byte[] in, int inPos, int inAvail, Context context) { // package pro
375375
* @param context the context to be used
376376
*/
377377
@Override
378-
void encode(byte[] in, int inPos, int inAvail, Context context) { // package protected for access from I/O streams
378+
void encode(final byte[] in, int inPos, final int inAvail, final Context context) { // package protected for access from I/O streams
379379
if (context.eof) {
380380
return;
381381
}
@@ -477,7 +477,7 @@ void encode(byte[] in, int inPos, int inAvail, Context context) { // package pro
477477
* @return {@code true} if the value is defined in the the Base32 alphabet {@code false} otherwise.
478478
*/
479479
@Override
480-
public boolean isInAlphabet(byte octet) {
480+
public boolean isInAlphabet(final byte octet) {
481481
return octet >= 0 && octet < decodeTable.length && decodeTable[octet] != -1;
482482
}
483483
}

src/main/java/org/apache/commons/codec/binary/Base32InputStream.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class Base32InputStream extends BaseNCodecInputStream {
4444
* @param in
4545
* InputStream to wrap.
4646
*/
47-
public Base32InputStream(InputStream in) {
47+
public Base32InputStream(final InputStream in) {
4848
this(in, false);
4949
}
5050

@@ -57,7 +57,7 @@ public Base32InputStream(InputStream in) {
5757
* @param doEncode
5858
* true if we should encode all data read from us, false if we should decode.
5959
*/
60-
public Base32InputStream(InputStream in, boolean doEncode) {
60+
public Base32InputStream(final InputStream in, final boolean doEncode) {
6161
super(in, new Base32(false), doEncode);
6262
}
6363

@@ -77,7 +77,7 @@ public Base32InputStream(InputStream in, boolean doEncode) {
7777
* If doEncode is true, each line of encoded data will be terminated with this byte sequence (e.g. \r\n).
7878
* If lineLength <= 0, the lineSeparator is not used. If doEncode is false lineSeparator is ignored.
7979
*/
80-
public Base32InputStream(InputStream in, boolean doEncode, int lineLength, byte[] lineSeparator) {
80+
public Base32InputStream(final InputStream in, final boolean doEncode, final int lineLength, final byte[] lineSeparator) {
8181
super(in, new Base32(lineLength, lineSeparator), doEncode);
8282
}
8383

src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class Base32OutputStream extends BaseNCodecOutputStream {
4444
* @param out
4545
* OutputStream to wrap.
4646
*/
47-
public Base32OutputStream(OutputStream out) {
47+
public Base32OutputStream(final OutputStream out) {
4848
this(out, true);
4949
}
5050

@@ -57,7 +57,7 @@ public Base32OutputStream(OutputStream out) {
5757
* @param doEncode
5858
* true if we should encode all data written to us, false if we should decode.
5959
*/
60-
public Base32OutputStream(OutputStream out, boolean doEncode) {
60+
public Base32OutputStream(final OutputStream out, final boolean doEncode) {
6161
super(out, new Base32(false), doEncode);
6262
}
6363

@@ -77,7 +77,7 @@ public Base32OutputStream(OutputStream out, boolean doEncode) {
7777
* If doEncode is true, each line of encoded data will be terminated with this byte sequence (e.g. \r\n).
7878
* If lineLength <= 0, the lineSeparator is not used. If doEncode is false lineSeparator is ignored.
7979
*/
80-
public Base32OutputStream(OutputStream out, boolean doEncode, int lineLength, byte[] lineSeparator) {
80+
public Base32OutputStream(final OutputStream out, final boolean doEncode, final int lineLength, final byte[] lineSeparator) {
8181
super(out, new Base32(lineLength, lineSeparator), doEncode);
8282
}
8383

0 commit comments

Comments
 (0)