|
@@ -31,16 +31,16 @@ package org.springframework.security.crypto.codec;
|
|
|
public final class Base64 {
|
|
|
|
|
|
/** No options specified. Value is zero. */
|
|
|
- public final static int NO_OPTIONS = 0;
|
|
|
+ public static final int NO_OPTIONS = 0;
|
|
|
|
|
|
/** Specify encoding in first bit. Value is one. */
|
|
|
- public final static int ENCODE = 1;
|
|
|
+ public static final int ENCODE = 1;
|
|
|
|
|
|
/** Specify decoding in first bit. Value is zero. */
|
|
|
- public final static int DECODE = 0;
|
|
|
+ public static final int DECODE = 0;
|
|
|
|
|
|
/** Do break lines when encoding. Value is 8. */
|
|
|
- public final static int DO_BREAK_LINES = 8;
|
|
|
+ public static final int DO_BREAK_LINES = 8;
|
|
|
|
|
|
/**
|
|
|
* Encode using Base64-like encoding that is URL- and Filename-safe as described in
|
|
@@ -50,31 +50,31 @@ public final class Base64 {
|
|
|
* Base64, or at the very least should not be called Base64 without also specifying
|
|
|
* that is was encoded using the URL- and Filename-safe dialect.
|
|
|
*/
|
|
|
- public final static int URL_SAFE = 16;
|
|
|
+ public static final int URL_SAFE = 16;
|
|
|
|
|
|
/**
|
|
|
* Encode using the special "ordered" dialect of Base64.
|
|
|
*/
|
|
|
- public final static int ORDERED = 32;
|
|
|
+ public static final int ORDERED = 32;
|
|
|
|
|
|
/** Maximum line length (76) of Base64 output. */
|
|
|
- private final static int MAX_LINE_LENGTH = 76;
|
|
|
+ private static final int MAX_LINE_LENGTH = 76;
|
|
|
|
|
|
/** The equals sign (=) as a byte. */
|
|
|
- private final static byte EQUALS_SIGN = (byte) '=';
|
|
|
+ private static final byte EQUALS_SIGN = (byte) '=';
|
|
|
|
|
|
/** The new line character (\n) as a byte. */
|
|
|
- private final static byte NEW_LINE = (byte) '\n';
|
|
|
+ private static final byte NEW_LINE = (byte) '\n';
|
|
|
|
|
|
- private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
|
|
|
+ private static final byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
|
|
|
|
|
|
- private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
|
|
|
+ private static final byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
|
|
|
|
|
|
/* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */
|
|
|
|
|
|
/** The 64 valid Base64 values. */
|
|
|
/* Host platform me be something funny like EBCDIC, so we hardcode these values. */
|
|
|
- private final static byte[] _STANDARD_ALPHABET = { (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E',
|
|
|
+ private static final byte[] _STANDARD_ALPHABET = { (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E',
|
|
|
(byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N',
|
|
|
(byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', (byte) 'V', (byte) 'W',
|
|
|
(byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f',
|
|
@@ -87,7 +87,7 @@ public final class Base64 {
|
|
|
* Translates a Base64 value to either its 6-bit reconstruction value or a negative
|
|
|
* number indicating some other meaning.
|
|
|
**/
|
|
|
- private final static byte[] _STANDARD_DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal
|
|
|
+ private static final byte[] _STANDARD_DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal
|
|
|
// 0
|
|
|
// -
|
|
|
// 8
|
|
@@ -132,7 +132,7 @@ public final class Base64 {
|
|
|
* Notice that the last two bytes become "hyphen" and "underscore" instead of "plus"
|
|
|
* and "slash."
|
|
|
*/
|
|
|
- private final static byte[] _URL_SAFE_ALPHABET = { (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E',
|
|
|
+ private static final byte[] _URL_SAFE_ALPHABET = { (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E',
|
|
|
(byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N',
|
|
|
(byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', (byte) 'V', (byte) 'W',
|
|
|
(byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f',
|
|
@@ -144,7 +144,7 @@ public final class Base64 {
|
|
|
/**
|
|
|
* Used in decoding URL- and Filename-safe dialects of Base64.
|
|
|
*/
|
|
|
- private final static byte[] _URL_SAFE_DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal
|
|
|
+ private static final byte[] _URL_SAFE_DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal
|
|
|
// 0
|
|
|
// -
|
|
|
// 8
|
|
@@ -186,7 +186,7 @@ public final class Base64 {
|
|
|
|
|
|
/* ******** O R D E R E D B A S E 6 4 A L P H A B E T ******** */
|
|
|
|
|
|
- private final static byte[] _ORDERED_ALPHABET = { (byte) '-', (byte) '0', (byte) '1', (byte) '2', (byte) '3',
|
|
|
+ private static final byte[] _ORDERED_ALPHABET = { (byte) '-', (byte) '0', (byte) '1', (byte) '2', (byte) '3',
|
|
|
(byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'A', (byte) 'B', (byte) 'C',
|
|
|
(byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L',
|
|
|
(byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U',
|
|
@@ -198,10 +198,8 @@ public final class Base64 {
|
|
|
/**
|
|
|
* Used in decoding the "ordered" dialect of Base64.
|
|
|
*/
|
|
|
- private final static byte[] _ORDERED_DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal
|
|
|
- // 0
|
|
|
- // -
|
|
|
- // 8
|
|
|
+ private static final byte[] _ORDERED_DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9,
|
|
|
+ // Decimal 0 - 8
|
|
|
-5, -5, // Whitespace: Tab and Linefeed
|
|
|
-9, -9, // Decimal 11 - 12
|
|
|
-5, // Whitespace: Carriage Return
|