Skip to content

Commit d9d45f6

Browse files
committed
Refactor instance variables that act like temps into locals
1 parent 0856a13 commit d9d45f6

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

  • src/main/java/org/apache/commons/codec/binary

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ public class Base32 extends BaseNCodec {
132132
// The private member fields below are used with the new streaming approach, which requires
133133
// some state be preserved between calls of encode() and decode().
134134

135-
/**
136-
* Convenience variable to help us determine when our buffer is going to run out of room and needs resizing. {@code decodeSize = {@link
137-
* #BYTES_PER_ENCODED_BLOCK} - 1 + lineSeparator.length;}
138-
*/
139-
private final int decodeSize;
140-
141135
/**
142136
* Decode table to use.
143137
*/
@@ -318,8 +312,6 @@ public Base32(final int lineLength, final byte[] lineSeparator, final boolean us
318312
this.encodeSize = BYTES_PER_ENCODED_BLOCK;
319313
this.lineSeparator = null;
320314
}
321-
this.decodeSize = this.encodeSize - 1;
322-
323315
if (isInAlphabet(padding) || Character.isWhitespace(padding)) {
324316
throw new IllegalArgumentException("pad must not be in alphabet or whitespace");
325317
}
@@ -347,13 +339,13 @@ public Base32(final int lineLength, final byte[] lineSeparator, final boolean us
347339
@Override
348340
void decode(final byte[] input, int inPos, final int inAvail, final Context context) {
349341
// package protected for access from I/O streams
350-
351342
if (context.eof) {
352343
return;
353344
}
354345
if (inAvail < 0) {
355346
context.eof = true;
356347
}
348+
final int decodeSize = this.encodeSize - 1;
357349
for (int i = 0; i < inAvail; i++) {
358350
final byte b = input[inPos++];
359351
if (b == pad) {
@@ -378,7 +370,6 @@ void decode(final byte[] input, int inPos, final int inAvail, final Context cont
378370
}
379371
}
380372
}
381-
382373
// Two forms of EOF as far as Base32 decoder is concerned: actual
383374
// EOF (-1) and first time '=' character is encountered in stream.
384375
// This approach makes the '=' padding characters completely optional.

0 commit comments

Comments
 (0)