public class Base64 extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
appendEncoded(Appendable app,
byte[] data)
Append a byte array to an
Appendable as Base64-encoded characters. |
static void |
appendEncoded(Appendable app,
byte[] data,
int start,
int end)
Append a section of a byte array to an
Appendable as Base64-encoded characters. |
static void |
appendURLEncoded(Appendable app,
byte[] data)
Append a byte array to an
Appendable as Base64-encoded characters, using the URL
variant of Base64. |
static void |
appendURLEncoded(Appendable app,
byte[] data,
int start,
int end)
Append a section of a byte array to an
Appendable as Base64-encoded characters,
using the URL variant of Base64. |
static byte[] |
decode(byte[] data)
Decode a byte array from Base64.
|
static byte[] |
decode(CharSequence data)
|
static byte[] |
encode(byte[] data)
Encode a byte array into Base64, returning another byte array.
|
String |
encodeString(byte[] data)
Encode a byte array into Base64, returning a string.
|
String |
encodeStringURL(byte[] data)
Encode a byte array into the URL variant of Base64, returning a string.
|
static byte[] |
encodeURL(byte[] data)
Encode a byte array into the URL variant of Base64, returning another byte array.
|
static int |
getEncodedLength(int n)
Get the encoded length of data encoded into Base64.
|
static int |
getEncodedURLLength(int n)
Get the encoded length of data encoded into the URL variant of Base64.
|
public static int getEncodedLength(int n)
n - the source data lengthNullPointerException - if the data is nullpublic static int getEncodedURLLength(int n)
n - the source data lengthNullPointerException - if the data is nullpublic static byte[] encode(byte[] data)
data - the source dataNullPointerException - if the data is nullpublic static byte[] encodeURL(byte[] data)
data - the source dataNullPointerException - if the data is nullpublic static void appendEncoded(Appendable app, byte[] data) throws IOException
Appendable as Base64-encoded characters.app - the Appendabledata - the source dataIOException - if thrown by the AppendableNullPointerException - if the data is nullpublic static void appendEncoded(Appendable app, byte[] data, int start, int end) throws IOException
Appendable as Base64-encoded characters.app - the Appendabledata - the source datastart - the start index of the data to be encodedend - the end indexIOException - if thrown by the AppendableNullPointerException - if the data is nullpublic static void appendURLEncoded(Appendable app, byte[] data) throws IOException
Appendable as Base64-encoded characters, using the URL
variant of Base64.app - the Appendabledata - the source dataIOException - if thrown by the AppendableNullPointerException - if the data is nullpublic static void appendURLEncoded(Appendable app, byte[] data, int start, int end) throws IOException
Appendable as Base64-encoded characters,
using the URL variant of Base64.app - the Appendabledata - the source datastart - the start index of the data to be encodedend - the end indexIOException - if thrown by the AppendableNullPointerException - if the data is nullpublic String encodeString(byte[] data)
data - the source dataNullPointerException - if the data is nullpublic String encodeStringURL(byte[] data)
data - the source dataNullPointerException - if the data is nullpublic static byte[] decode(byte[] data)
data - the source dataIllegalArgumentException - if the data is not valid Base64NullPointerException - if the data is nullpublic static byte[] decode(CharSequence data)
CharSequence (String, StringBuilder etc.) from Base64.
Both the original and the URL variants are handled.data - the source dataIllegalArgumentException - if the data is not valid Base64NullPointerException - if the data is nullCopyright © 2020. All rights reserved.