public final class Base64 extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
decodeBase64(char[] text,
int from,
int len) |
static byte[] |
decodeBase64(CharSequence text) |
static byte[] |
decodeBase64(CharSequence text,
int from,
int len) |
static byte[] |
decodeBase64(String text) |
static byte[] |
decodeBase64(String text,
int from,
int length) |
static byte[] |
decodeBase64V2(String text,
int from,
int length) |
static char |
encode(int i) |
static String |
encodeBase64(byte[] input) |
static String |
encodeBase64(byte[] input,
int offset,
int len) |
static void |
encodeBase64(byte[] input,
int offset,
int len,
Appendable result) |
static int |
encodeBase64(byte[] input,
int offset,
int len,
byte[] out,
int cptr)
Encodes a byte array into another byte array by first doing base64 encoding then encoding the result in ASCII.
|
static int |
encodeBase64(byte[] input,
int offset,
int len,
char[] output,
int cptr)
Encodes a byte array into a char array by doing base64 encoding.
|
static CharSequence |
encodeBase64V2(byte[] input,
int offset,
int len)
Alternate implementation, should be better for large data.
|
static byte |
encodeByte(int i) |
public static byte[] decodeBase64(CharSequence text)
public static byte[] decodeBase64(String text)
public static byte[] decodeBase64(String text, int from, int length)
public static byte[] decodeBase64V2(String text, int from, int length)
public static byte[] decodeBase64(CharSequence text, int from, int len)
text
- base64Binary data is likely to be long, and decoding requires each character to be accessed twice (once
for counting length, another for decoding.)from
- the index of the first character in the sequence.len
- - the number of characters to decode.public static byte[] decodeBase64(char[] text, int from, int len)
public static char encode(int i)
public static byte encodeByte(int i)
public static String encodeBase64(byte[] input)
public static String encodeBase64(byte[] input, int offset, int len)
public static CharSequence encodeBase64V2(byte[] input, int offset, int len)
input
- - the byte array to encodeoffset
- - the index of the first byte that is to be encoded.len
- - the number of bytes to encode.public static void encodeBase64(byte[] input, int offset, int len, Appendable result) throws IOException
IOException
public static int encodeBase64(byte[] input, int offset, int len, char[] output, int cptr)
input
- - the byte array to encode.offset
- - the index of the first byte to encode.len
- - the number of bytes to encode.output
- - the destination character array to encode to.cptr
- - the index of the first character to encode to.ptr+((len+2)/3)*4
, which is the new offset in the output buffer where the further
bytes should be placed.public static int encodeBase64(byte[] input, int offset, int len, byte[] out, int cptr)
input
- - the byte array to encode.offset
- - the index of the first byte to encode.len
- - the number of bytes to encode.out
- - the destination byte array that represents an ASCII string to encode to.cptr
- - the index of the first byte in the destination array to encode to.ptr+((len+2)/3)*4
, which is the new offset in the output buffer where the further
bytes should be placed.Copyright © 2018 SPF4J. All rights reserved.