@@ -146,10 +146,10 @@ public class Base64 {
146
146
}
147
147
148
148
/**
149
- * Returns whether or not the <code>octect</code> is in the base 64 alphabet.
149
+ * Returns whether the <code>octect</code> is in the base 64 alphabet.
150
150
*
151
151
* @param b The value to test
152
- * @return <code>true</code> if the value is defined in the the base 64 alphabet, <code>false</code> otherwise.
152
+ * @return <code>true</code> if the value is defined in the base 64 alphabet, <code>false</code> otherwise.
153
153
*/
154
154
public static boolean isBase64 (byte b ) {
155
155
return (b == PAD ) || (b >= 0 && base64Alphabet [b ] >= 0 );
@@ -223,8 +223,7 @@ public Object decode(Object pObject) throws IllegalArgumentException {
223
223
}
224
224
225
225
/**
226
- * Decodes a byte[] containing containing
227
- * characters in the Base64 alphabet.
226
+ * Decodes a byte[] containing characters in the Base64 alphabet.
228
227
*
229
228
* @param pArray A byte array containing Base64 character data
230
229
* @return a byte array containing binary data
@@ -246,7 +245,7 @@ public static byte[] encodeBase64(byte[] binaryData, boolean isChunked) {
246
245
int lengthDataBits = binaryData .length * EIGHTBIT ;
247
246
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP ;
248
247
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP ;
249
- byte encodedData [] ;
248
+ byte [] encodedData ;
250
249
int encodedDataLength ;
251
250
int nbrChunks = 0 ;
252
251
@@ -293,9 +292,6 @@ public static byte[] encodeBase64(byte[] binaryData, boolean isChunked) {
293
292
byte val3 = ((b3 & SIGN ) == 0 ) ? (byte ) (b3 >> 6 ) : (byte ) ((b3 ) >> 6 ^ 0xfc );
294
293
295
294
encodedData [encodedIndex ] = lookUpBase64Alphabet [val1 ];
296
- // log.debug( "val2 = " + val2 );
297
- // log.debug( "k4 = " + (k<<4) );
298
- // log.debug( "vak = " + (val2 | (k<<4)) );
299
295
encodedData [encodedIndex + 1 ] = lookUpBase64Alphabet [val2 | (k << 4 )];
300
296
encodedData [encodedIndex + 2 ] = lookUpBase64Alphabet [(l << 2 ) | val3 ];
301
297
encodedData [encodedIndex + 3 ] = lookUpBase64Alphabet [b3 & 0x3f ];
@@ -320,8 +316,6 @@ public static byte[] encodeBase64(byte[] binaryData, boolean isChunked) {
320
316
if (fewerThan24bits == EIGHTBIT ) {
321
317
b1 = binaryData [dataIndex ];
322
318
k = (byte ) (b1 & 0x03 );
323
- // log.debug("b1=" + b1);
324
- // log.debug("b1<<2 = " + (b1>>2) );
325
319
byte val1 = ((b1 & SIGN ) == 0 ) ? (byte ) (b1 >> 2 ) : (byte ) ((b1 ) >> 2 ^ 0xc0 );
326
320
encodedData [encodedIndex ] = lookUpBase64Alphabet [val1 ];
327
321
encodedData [encodedIndex + 1 ] = lookUpBase64Alphabet [k << 4 ];
@@ -374,7 +368,7 @@ public static byte[] decodeBase64(byte[] base64Data) {
374
368
}
375
369
376
370
int numberQuadruple = base64Data .length / FOURBYTE ;
377
- byte decodedData [] ;
371
+ byte [] decodedData ;
378
372
byte b1 , b2 , b3 , b4 , marker0 , marker1 ;
379
373
380
374
// Throw away anything not in base64Data
@@ -432,7 +426,7 @@ public static byte[] decodeBase64(byte[] base64Data) {
432
426
* @return The data, less whitespace (see RFC 2045).
433
427
*/
434
428
static byte [] discardWhitespace (byte [] data ) {
435
- byte groomedData [] = new byte [data .length ];
429
+ byte [] groomedData = new byte [data .length ];
436
430
int bytesCopied = 0 ;
437
431
438
432
for (byte datum : data ) {
@@ -447,24 +441,24 @@ static byte[] discardWhitespace(byte[] data) {
447
441
}
448
442
}
449
443
450
- byte packedData [] = new byte [bytesCopied ];
444
+ byte [] packedData = new byte [bytesCopied ];
451
445
452
446
System .arraycopy (groomedData , 0 , packedData , 0 , bytesCopied );
453
447
454
448
return packedData ;
455
449
}
456
450
457
451
/**
458
- * Discards any characters outside of the base64 alphabet, per
452
+ * Discards any characters outside the base64 alphabet, per
459
453
* the requirements on page 25 of RFC 2045 - "Any characters
460
- * outside of the base64 alphabet are to be ignored in base64
454
+ * outside the base64 alphabet are to be ignored in base64
461
455
* encoded data."
462
456
*
463
457
* @param data The base-64 encoded data to groom
464
458
* @return The data, less non-base64 characters (see RFC 2045).
465
459
*/
466
460
static byte [] discardNonBase64 (byte [] data ) {
467
- byte groomedData [] = new byte [data .length ];
461
+ byte [] groomedData = new byte [data .length ];
468
462
int bytesCopied = 0 ;
469
463
470
464
for (byte datum : data ) {
@@ -473,7 +467,7 @@ static byte[] discardNonBase64(byte[] data) {
473
467
}
474
468
}
475
469
476
- byte packedData [] = new byte [bytesCopied ];
470
+ byte [] packedData = new byte [bytesCopied ];
477
471
478
472
System .arraycopy (groomedData , 0 , packedData , 0 , bytesCopied );
479
473
0 commit comments