Base64
instead@Deprecated
public class B64Code
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
private static char |
__pad
Deprecated.
|
private static char[] |
__rfc1421alphabet
Deprecated.
|
private static byte[] |
__rfc1421nibbles
Deprecated.
|
private static char[] |
__rfc4648urlAlphabet
Deprecated.
|
private static byte[] |
__rfc4648urlNibbles
Deprecated.
|
Modifier | Constructor and Description |
---|---|
private |
B64Code()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(char[] b)
Deprecated.
Fast Base 64 decode as described in RFC 1421.
|
static byte[] |
decode(java.lang.String encoded)
Deprecated.
Base 64 decode as described in RFC 2045.
|
static void |
decode(java.lang.String encoded,
java.io.ByteArrayOutputStream bout)
Deprecated.
Base 64 decode as described in RFC 2045.
|
static java.lang.String |
decode(java.lang.String encoded,
java.nio.charset.Charset charEncoding)
Deprecated.
Base 64 decode as described in RFC 2045.
|
static java.lang.String |
decode(java.lang.String encoded,
java.lang.String charEncoding)
Deprecated.
Base 64 decode as described in RFC 2045.
|
static byte[] |
decodeRFC4648URL(java.lang.String encoded)
Deprecated.
|
static void |
decodeRFC4648URL(java.lang.String encoded,
java.io.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 RFC2045
|
static void |
encode(int value,
java.lang.Appendable buf)
Deprecated.
|
static void |
encode(long lvalue,
java.lang.Appendable buf)
Deprecated.
|
static java.lang.String |
encode(java.lang.String s)
Deprecated.
use
Base64.Encoder#encodeToString(byte[]) } instead. |
static java.lang.String |
encode(java.lang.String s,
java.nio.charset.Charset charEncoding)
Deprecated.
Base 64 encode as described in RFC 1421.
|
static java.lang.String |
encode(java.lang.String s,
java.lang.String charEncoding)
Deprecated.
Base 64 encode as described in RFC 1421.
|
private static final char __pad
private static final char[] __rfc1421alphabet
private static final byte[] __rfc1421nibbles
private static final char[] __rfc4648urlAlphabet
private static final byte[] __rfc4648urlNibbles
public static java.lang.String encode(java.lang.String s)
Base64.Encoder#encodeToString(byte[])
} instead.Does not insert whitespace as described in RFC 1521.
s
- String to encode.public static java.lang.String encode(java.lang.String s, java.lang.String charEncoding)
Does not insert whitespace as described in RFC 1521.
s
- String to encode.charEncoding
- String representing the name of
the character encoding of the provided input String.public static java.lang.String encode(java.lang.String s, java.nio.charset.Charset charEncoding)
Does not insert whitespace as described in RFC 1521.
s
- String to encode.charEncoding
- The character encoding of the provided input String.public static char[] encode(byte[] b)
Does not insert whitespace as described in RFC 1521.
Avoids creating extra copies of the input/output.
b
- byte array to encode.public static char[] encode(byte[] b, boolean rfc2045)
Does not insert whitespace as described in RFC 1521, unless rfc2045 is passed as true.
Avoids creating extra copies of the input/output.
b
- byte array to encode.rfc2045
- If true, break lines at 76 characters with CRLFpublic static java.lang.String decode(java.lang.String encoded, java.lang.String charEncoding)
Unlike decode(char[])
, extra whitespace is ignored.
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.java.nio.charset.UnsupportedCharsetException
- if the encoding is not supportedjava.lang.IllegalArgumentException
- if the input is not a valid
B64 encoding.public static java.lang.String decode(java.lang.String encoded, java.nio.charset.Charset charEncoding)
Unlike decode(char[])
, extra whitespace is ignored.
encoded
- String to decode.charEncoding
- Character encoding
used to map the decoded bytes into a String. If null
the platforms default charset is used.java.lang.IllegalArgumentException
- if the input is not a valid
B64 encoding.public static byte[] decode(char[] b)
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.
b
- char array to decode.java.lang.IllegalArgumentException
- if the input is not a valid
B64 encoding.public static byte[] decode(java.lang.String encoded)
Unlike decode(char[])
, extra whitespace is ignored.
encoded
- String to decode.java.lang.IllegalArgumentException
- if the input is not a valid
B64 encoding.public static void decode(java.lang.String encoded, java.io.ByteArrayOutputStream bout)
Unlike decode(char[])
, extra whitespace is ignored.
encoded
- String to decode.bout
- stream for decoded bytesjava.lang.IllegalArgumentException
- if the input is not a valid
B64 encoding.public static byte[] decodeRFC4648URL(java.lang.String encoded)
public static void decodeRFC4648URL(java.lang.String encoded, java.io.ByteArrayOutputStream bout)
Unlike decode(char[])
, extra whitespace is ignored.
encoded
- String to decode.bout
- stream for decoded bytesjava.lang.IllegalArgumentException
- if the input is not a valid
B64 encoding.public static void encode(int value, java.lang.Appendable buf) throws java.io.IOException
java.io.IOException
public static void encode(long lvalue, java.lang.Appendable buf) throws java.io.IOException
java.io.IOException