public final class Base64 extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Base64.InputStream
A filter input stream that decodes the base-64 encoded data obtained
from its underlying InputStream.
|
static class |
Base64.OutputStream
A filter output stream that encodes in base-64 the binary data passed
to its underlying OutputStream.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(String s)
Decodes base-64 encoded string.
|
static byte[] |
decode(String s,
int limit)
Same as
decode(String) , except that argument limit allows to
limit the number of decoded bytes. |
static String |
encode(byte[] b)
Equivalent to
encode(b, 76) . |
static String |
encode(byte[] b,
int maxCols)
Encodes binary data to base-64.
|
public static byte[] decode(String s)
s
- base-64 string to be decodednull
if string cannot be
decoded.public static byte[] decode(String s, int limit)
decode(String)
, except that argument limit allows to
limit the number of decoded bytes. This is useful, for example, to
detect the format of a base-64 encoded image based on its magic string.public static String encode(byte[] b)
encode(b, 76)
.public static String encode(byte[] b, int maxCols)
b
- binary data to be encodedmaxCols
- wrap encoded lines after maxCols characters.
Use 0 to disable line wrapping.