public final 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. All methods that begin with 'c' will use char arrays (as output on encode, as input on decode).
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
code2nibble |
static byte[] |
code2nibbleUrlSafe |
static byte[] |
nibble2code |
static byte[] |
nibble2codeUrlSafe |
static byte |
pad |
static byte |
padUrlSafe |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
cdecode(char[] b)
Fast Base 64 decode as described in RFC 1421.
|
static byte[] |
cdecode(char[] input,
int inOffset,
int inLen) |
static byte[] |
cdecode(char[] input,
int inOffset,
int inLen,
byte[] code2nibble,
byte pad)
Fast Base 64 decode as described in RFC 1421.
|
static byte[] |
cdecodeUS(char[] input,
int inOffset,
int inLen) |
static char[] |
cencode(byte[] input)
Fast Base 64 encode as described in RFC 1421.
|
static char[] |
cencode(byte[] input,
int inOffset,
int inLen)
Fast Base 64 encode as described in RFC 1421.
|
static char[] |
cencodeUS(byte[] input,
int inOffset,
int inLen)
Fast Base 64 encode as described in RFC 1421.
|
static byte[] |
decode(byte[] b)
Fast Base 64 decode as described in RFC 1421.
|
static byte[] |
decode(byte[] input,
int inOffset,
int inLen) |
static byte[] |
decode(byte[] input,
int inOffset,
int inLen,
byte[] code2nibble,
byte pad)
Fast Base 64 decode as described in RFC 1421.
|
static byte[] |
decode(java.lang.String str)
Returns the base 64 decoded bytes.
|
static byte[] |
decode(java.lang.String str,
int inOffset,
int inLen) |
static byte[] |
decode(java.lang.String str,
int inOffset,
int inLen,
byte[] code2nibble,
byte pad)
Returns the base 64 decoded bytes.
|
static int |
decodeTo(byte[] output,
int outOffset,
byte[] input,
int inOffset,
int inLen,
byte[] code2nibble,
byte pad)
Returns the length of the decoded base64 input (written to the
provided
output byte array). |
static int |
decodeTo(byte[] output,
int outOffset,
java.lang.String str,
int inOffset,
int inLen,
byte[] code2nibble,
byte pad)
Returns the length of the decoded base64 input (written to the
provided
output byte array). |
static byte[] |
decodeUS(byte[] input,
int inOffset,
int inLen) |
static byte[] |
decodeUS(java.lang.String str,
int inOffset,
int inLen) |
static byte[] |
encode(byte[] input)
Fast Base 64 encode as described in RFC 1421.
|
static byte[] |
encode(byte[] input,
int inOffset,
int inLen)
Fast Base 64 encode as described in RFC 1421.
|
static LinkedBuffer |
encode(byte[] input,
int inOffset,
int inLen,
byte[] nibble2code,
byte pad,
WriteSession session,
LinkedBuffer lb)
Encodes the byte array into the
LinkedBuffer and grows when full. |
static LinkedBuffer |
encode(byte[] input,
int inOffset,
int inLen,
WriteSession session,
LinkedBuffer lb)
Encodes the byte array into the
LinkedBuffer and grows when full. |
static byte[] |
encodeUS(byte[] input,
int inOffset,
int inLen)
Fast Base 64 encode as described in RFC 1421.
|
static LinkedBuffer |
sencode(byte[] input,
int inOffset,
int inLen,
byte[] nibble2code,
byte pad,
WriteSession session,
LinkedBuffer lb)
Encodes the byte array into the
LinkedBuffer and flushes
to the OutputStream when buffer is full. |
static LinkedBuffer |
sencode(byte[] input,
int inOffset,
int inLen,
WriteSession session,
LinkedBuffer lb)
Encodes the byte array into the
LinkedBuffer and flushes
to the OutputStream when buffer is full. |
public static final byte pad
public static final byte padUrlSafe
public static final byte[] nibble2code
public static final byte[] nibble2codeUrlSafe
public static final byte[] code2nibble
public static final byte[] code2nibbleUrlSafe
public static byte[] encode(byte[] input)
public static byte[] encode(byte[] input,
int inOffset,
int inLen)
public static byte[] encodeUS(byte[] input,
int inOffset,
int inLen)
public static char[] cencode(byte[] input)
public static char[] cencode(byte[] input,
int inOffset,
int inLen)
public static char[] cencodeUS(byte[] input,
int inOffset,
int inLen)
public static LinkedBuffer encode(byte[] input, int inOffset, int inLen, WriteSession session, LinkedBuffer lb) throws java.io.IOException
LinkedBuffer and grows when full.java.io.IOExceptionpublic static LinkedBuffer encode(byte[] input, int inOffset, int inLen, byte[] nibble2code, byte pad, WriteSession session, LinkedBuffer lb) throws java.io.IOException
LinkedBuffer and grows when full.java.io.IOExceptionpublic static LinkedBuffer sencode(byte[] input, int inOffset, int inLen, WriteSession session, LinkedBuffer lb) throws java.io.IOException
LinkedBuffer and flushes
to the OutputStream when buffer is full.java.io.IOExceptionpublic static LinkedBuffer sencode(byte[] input, int inOffset, int inLen, byte[] nibble2code, byte pad, WriteSession session, LinkedBuffer lb) throws java.io.IOException
LinkedBuffer and flushes
to the OutputStream when buffer is full.java.io.IOExceptionpublic static byte[] decode(byte[] b)
public static byte[] cdecode(char[] b)
public static byte[] decode(byte[] input,
int inOffset,
int inLen)
public static byte[] decodeUS(byte[] input,
int inOffset,
int inLen)
public static byte[] decode(byte[] input,
int inOffset,
int inLen,
byte[] code2nibble,
byte pad)
Does not attempt to cope with extra whitespace as described in RFC 1521.
Avoids creating extra copies of the input/output.
Note this code has been flattened for performance.
input - byte array to decode.inOffset - the offset.inLen - the length.java.lang.IllegalArgumentException - if the input is not a valid
B64 encoding.public static byte[] cdecode(char[] input,
int inOffset,
int inLen)
public static byte[] cdecodeUS(char[] input,
int inOffset,
int inLen)
public static byte[] cdecode(char[] input,
int inOffset,
int inLen,
byte[] code2nibble,
byte pad)
Does not attempt to cope with extra whitespace as described in RFC 1521.
Avoids creating extra copies of the input/output.
Note this code has been flattened for performance.
input - char array to decode.inOffset - the offset.inLen - the length.java.lang.IllegalArgumentException - if the input is not a valid
B64 encoding.public static int decodeTo(byte[] output,
int outOffset,
byte[] input,
int inOffset,
int inLen,
byte[] code2nibble,
byte pad)
output byte array).
The output byte array must have enough capacity or it will fail.public static byte[] decode(java.lang.String str)
str must already be base-64 encoded.public static byte[] decode(java.lang.String str,
int inOffset,
int inLen)
public static byte[] decodeUS(java.lang.String str,
int inOffset,
int inLen)
public static byte[] decode(java.lang.String str,
int inOffset,
int inLen,
byte[] code2nibble,
byte pad)
str must already be base-64 encoded.public static int decodeTo(byte[] output,
int outOffset,
java.lang.String str,
int inOffset,
int inLen,
byte[] code2nibble,
byte pad)
output byte array).
The output byte array must have enough capacity or it will fail.Copyright © 2009-2017. All Rights Reserved.