public class Base64 extends Object
Constructor and Description |
---|
Base64() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(BufferedReader reader)
Base64 decode the lines from the reader and return an InputStream with
the bytes.
|
static byte[] |
decode(String base64)
Decode a Base64-Basic encoded string to a byte array
This is a wrapper preserving the previous interface.
|
static byte[] |
decodeBasic(String base64)
Decode a Base64-Basic encoded string to a byte array
|
protected static byte[] |
decodeHelper(String base64,
boolean isUrlSafe)
Decode a Base64-Basic or UrlSafe encoded string to a byte array
|
static byte[] |
decodeUrl(String base64)
Decode a Base64-UrlSafe encoded string to a byte array
|
static String |
encode(byte[] raw)
Encode a byte array and fold lines at the standard 76th character.
|
static String |
encode(byte[] raw,
int wrap)
Encode a byte array in Base64-Basic format and return an optionally wrapped
line
This is a wrapper preserving the previous interface.
|
static String |
encodeBasic(byte[] raw)
Encode a byte array in Base64-Basic format and return an optionally wrapped
line
|
protected static char[] |
encodeBlock(byte[] raw,
int offset,
boolean isUrlSafe) |
protected static char[] |
encodeFullBlock(byte[] raw,
int offset,
boolean isUrlSafe) |
protected static String |
encodeHelper(byte[] raw,
int wrap,
boolean isUrlSafe)
Encode a byte array in Base64-Basic or UrlSafe format and return an optionally wrapped
line
|
static String |
encodeUrl(byte[] raw)
Encode a byte array in Base64-UrlSafe format and return an optionally wrapped
line
|
protected static char |
getChar(int sixBit,
boolean isUrlSafe) |
protected static int |
getValue(char c,
boolean isUrlSafe) |
public static byte[] decodeBasic(String base64)
Decode a Base64-Basic encoded string to a byte array
base64
- String
encoded string (single line only !!)public static byte[] decodeUrl(String base64)
Decode a Base64-UrlSafe encoded string to a byte array
base64
- String
encoded string (single line only !!)public static byte[] decode(String base64)
Decode a Base64-Basic encoded string to a byte array
This is a wrapper preserving the previous interface.base64
- String
encoded string (single line only !!)protected static byte[] decodeHelper(String base64, boolean isUrlSafe)
Decode a Base64-Basic or UrlSafe encoded string to a byte array
base64
- String
encoded string (single line only !!)isUrlSafe
- public static String encodeBasic(byte[] raw)
Encode a byte array in Base64-Basic format and return an optionally wrapped line
raw
- byte[]
data to be encod4.String
with encoded datapublic static String encodeUrl(byte[] raw)
Encode a byte array in Base64-UrlSafe format and return an optionally wrapped line
raw
- byte[]
data to be encodedString
with encoded datapublic static String encode(byte[] raw, int wrap)
Encode a byte array in Base64-Basic format and return an optionally wrapped line
This is a wrapper preserving the previous interface.raw
- byte[]
data to be encodedwrap
- int
length of wrapped lines; No wrapping if less than 4.String
with encoded dataprotected static String encodeHelper(byte[] raw, int wrap, boolean isUrlSafe)
Encode a byte array in Base64-Basic or UrlSafe format and return an optionally wrapped line
raw
- byte[]
data to be encodedwrap
- int
length of wrapped lines; No wrapping if less than 4.isUrlSafe
- String
with encoded datapublic static String encode(byte[] raw)
raw
- byte[]
to be base64 encodedString
with encoded datapublic static byte[] decode(BufferedReader reader) throws IOException
reader
- IOException
protected static char[] encodeBlock(byte[] raw, int offset, boolean isUrlSafe)
protected static char[] encodeFullBlock(byte[] raw, int offset, boolean isUrlSafe)
protected static char getChar(int sixBit, boolean isUrlSafe)
protected static int getValue(char c, boolean isUrlSafe)
Copyright © 2021. All rights reserved.