Skip to content

Commit 34d871e

Browse files
committed
Fix PMD violations
1 parent a79f046 commit 34d871e

1 file changed

Lines changed: 30 additions & 30 deletions

File tree

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

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

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ public class Base64 extends BaseNCodec {
118118
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 // 70-7a p-z
119119
};
120120

121+
// The static final fields above are used for the original static byte[] methods on Base64.
122+
// The private member fields below are used with the new streaming approach, which requires
123+
// some state be preserved between calls of encode() and decode().
124+
121125
/**
122126
* Base64 uses 6-bit fields.
123127
*/
@@ -128,9 +132,32 @@ public class Base64 extends BaseNCodec {
128132
/** Mask used to extract 2 bits, used when decoding final trailing character. */
129133
private static final int MASK_2BITS = 0x3;
130134

131-
// The static final fields above are used for the original static byte[] methods on Base64.
132-
// The private member fields below are used with the new streaming approach, which requires
133-
// some state be preserved between calls of encode() and decode().
135+
/**
136+
* Encode table to use: either STANDARD or URL_SAFE. Note: the DECODE_TABLE above remains static because it is able
137+
* to decode both STANDARD and URL_SAFE streams, but the encodeTable must be a member variable so we can switch
138+
* between the two modes.
139+
*/
140+
private final byte[] encodeTable;
141+
142+
/** Only one decode table currently; keep for consistency with Base32 code. */
143+
private final byte[] decodeTable = DECODE_TABLE;
144+
145+
/**
146+
* Line separator for encoding. Not used when decoding. Only used if lineLength > 0.
147+
*/
148+
private final byte[] lineSeparator;
149+
150+
/**
151+
* Convenience variable to help us determine when our buffer is going to run out of room and needs resizing.
152+
* {@code decodeSize = 3 + lineSeparator.length;}
153+
*/
154+
private final int decodeSize;
155+
156+
/**
157+
* Convenience variable to help us determine when our buffer is going to run out of room and needs resizing.
158+
* {@code encodeSize = 4 + lineSeparator.length;}
159+
*/
160+
private final int encodeSize;
134161

135162
/**
136163
* Decodes Base64 data into octets.
@@ -414,33 +441,6 @@ static byte[] toIntegerBytes(final BigInteger bigInt) {
414441
return resizedBytes;
415442
}
416443

417-
/**
418-
* Encode table to use: either STANDARD or URL_SAFE. Note: the DECODE_TABLE above remains static because it is able
419-
* to decode both STANDARD and URL_SAFE streams, but the encodeTable must be a member variable so we can switch
420-
* between the two modes.
421-
*/
422-
private final byte[] encodeTable;
423-
424-
// Only one decode table currently; keep for consistency with Base32 code
425-
private final byte[] decodeTable = DECODE_TABLE;
426-
427-
/**
428-
* Line separator for encoding. Not used when decoding. Only used if lineLength > 0.
429-
*/
430-
private final byte[] lineSeparator;
431-
432-
/**
433-
* Convenience variable to help us determine when our buffer is going to run out of room and needs resizing.
434-
* {@code decodeSize = 3 + lineSeparator.length;}
435-
*/
436-
private final int decodeSize;
437-
438-
/**
439-
* Convenience variable to help us determine when our buffer is going to run out of room and needs resizing.
440-
* {@code encodeSize = 4 + lineSeparator.length;}
441-
*/
442-
private final int encodeSize;
443-
444444
/**
445445
* Creates a Base64 codec used for decoding (all modes) and encoding in URL-unsafe mode.
446446
* <p>

0 commit comments

Comments
 (0)