Class B64Code
Does not insert or interpret whitespace as described in RFC 1521. If you require this you must pre/post process your data.
Note that in a web context the usual case is to not want linebreaks or other white space in the encoded output.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char
Deprecated.private static final char[]
Deprecated.private static final byte[]
Deprecated.private static final char[]
Deprecated.private static final byte[]
Deprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
decode
(char[] b) Deprecated.Fast Base 64 decode as described in RFC 1421.static byte[]
Deprecated.Base 64 decode as described in RFC 2045.static void
decode
(String encoded, ByteArrayOutputStream bout) Deprecated.Base 64 decode as described in RFC 2045.static String
Deprecated.Base 64 decode as described in RFC 2045.static String
Deprecated.Base 64 decode as described in RFC 2045.static byte[]
decodeRFC4648URL
(String encoded) Deprecated.static void
decodeRFC4648URL
(String encoded, ByteArrayOutputStream bout) Deprecated.Base 64 decode as described in RFC 4648 URL.static char[]
encode
(byte[] b) Deprecated.Fast Base 64 encode as described in RFC 1421.static char[]
encode
(byte[] b, boolean rfc2045) Deprecated.Fast Base 64 encode as described in RFC 1421 and RFC2045static void
encode
(int value, Appendable buf) Deprecated.static void
encode
(long lvalue, Appendable buf) Deprecated.static String
Deprecated.useBase64.Encoder.encodeToString(byte[])
} instead.static String
Deprecated.Base 64 encode as described in RFC 1421.static String
Deprecated.Base 64 encode as described in RFC 1421.
-
Field Details
-
__pad
private static final char __padDeprecated.- See Also:
-
__rfc1421alphabet
private static final char[] __rfc1421alphabetDeprecated. -
__rfc1421nibbles
private static final byte[] __rfc1421nibblesDeprecated. -
__rfc4648urlAlphabet
private static final char[] __rfc4648urlAlphabetDeprecated. -
__rfc4648urlNibbles
private static final byte[] __rfc4648urlNibblesDeprecated.
-
-
Constructor Details
-
B64Code
private B64Code()Deprecated.
-
-
Method Details
-
encode
Deprecated.useBase64.Encoder.encodeToString(byte[])
} instead.Base 64 encode as described in RFC 1421.Does not insert whitespace as described in RFC 1521.
- Parameters:
s
- String to encode.- Returns:
- String containing the encoded form of the input.
-
encode
Deprecated.Base 64 encode as described in RFC 1421.Does not insert whitespace as described in RFC 1521.
- Parameters:
s
- String to encode.charEncoding
- String representing the name of the character encoding of the provided input String.- Returns:
- String containing the encoded form of the input.
-
encode
Deprecated.Base 64 encode as described in RFC 1421.Does not insert whitespace as described in RFC 1521.
- Parameters:
s
- String to encode.charEncoding
- The character encoding of the provided input String.- Returns:
- String containing the encoded form of the input.
-
encode
public static char[] encode(byte[] b) Deprecated.Fast Base 64 encode as described in RFC 1421.Does not insert whitespace as described in RFC 1521.
Avoids creating extra copies of the input/output.
- Parameters:
b
- byte array to encode.- Returns:
- char array containing the encoded form of the input.
-
encode
public static char[] encode(byte[] b, boolean rfc2045) Deprecated.Fast Base 64 encode as described in RFC 1421 and RFC2045Does not insert whitespace as described in RFC 1521, unless rfc2045 is passed as true.
Avoids creating extra copies of the input/output.
- Parameters:
b
- byte array to encode.rfc2045
- If true, break lines at 76 characters with CRLF- Returns:
- char array containing the encoded form of the input.
-
decode
Deprecated.Base 64 decode as described in RFC 2045.Unlike
decode(char[])
, extra whitespace is ignored.- Parameters:
encoded
- String to decode.charEncoding
- String representing the character encoding used to map the decoded bytes into a String. If null the platforms default charset is used.- Returns:
- String decoded byte array.
- Throws:
UnsupportedCharsetException
- if the encoding is not supportedIllegalArgumentException
- if the input is not a valid B64 encoding.
-
decode
Deprecated.Base 64 decode as described in RFC 2045.Unlike
decode(char[])
, extra whitespace is ignored.- Parameters:
encoded
- String to decode.charEncoding
- Character encoding used to map the decoded bytes into a String. If null the platforms default charset is used.- Returns:
- String decoded byte array.
- Throws:
IllegalArgumentException
- if the input is not a valid B64 encoding.
-
decode
public static byte[] decode(char[] b) Deprecated.Fast Base 64 decode as described in RFC 1421.Unlike other decode methods, this does not attempt to cope with extra whitespace as described in RFC 1521/2045.
Avoids creating extra copies of the input/output.
Note this code has been flattened for performance.
- Parameters:
b
- char array to decode.- Returns:
- byte array containing the decoded form of the input.
- Throws:
IllegalArgumentException
- if the input is not a valid B64 encoding.
-
decode
Deprecated.Base 64 decode as described in RFC 2045.Unlike
decode(char[])
, extra whitespace is ignored.- Parameters:
encoded
- String to decode.- Returns:
- byte array containing the decoded form of the input.
- Throws:
IllegalArgumentException
- if the input is not a valid B64 encoding.
-
decode
Deprecated.Base 64 decode as described in RFC 2045.Unlike
decode(char[])
, extra whitespace is ignored.- Parameters:
encoded
- String to decode.bout
- stream for decoded bytes- Throws:
IllegalArgumentException
- if the input is not a valid B64 encoding.
-
decodeRFC4648URL
Deprecated. -
decodeRFC4648URL
Deprecated.Base 64 decode as described in RFC 4648 URL.Unlike
decode(char[])
, extra whitespace is ignored.- Parameters:
encoded
- String to decode.bout
- stream for decoded bytes- Throws:
IllegalArgumentException
- if the input is not a valid B64 encoding.
-
encode
Deprecated.- Throws:
IOException
-
encode
Deprecated.- Throws:
IOException
-
Base64
instead