public final class Base64
extends java.lang.Object
ByteBuf
that encodes and decodes to and from
Base64 notation.
The encoding and decoding algorithm in this class has been derived from Robert Harder's Public Domain Base64 Encoder/Decoder.
Modifier and Type | Field and Description |
---|---|
private static byte |
EQUALS_SIGN
The equals sign (=) as a byte.
|
private static byte |
EQUALS_SIGN_ENC |
private static int |
MAX_LINE_LENGTH
Maximum line length (76) of Base64 output.
|
private static byte |
NEW_LINE
The new line character (\n) as a byte.
|
private static byte |
WHITE_SPACE_ENC |
Modifier | Constructor and Description |
---|---|
private |
Base64() |
Modifier and Type | Method and Description |
---|---|
private static byte[] |
alphabet(Base64Dialect dialect) |
private static boolean |
breakLines(Base64Dialect dialect) |
private static byte[] |
decodabet(Base64Dialect dialect) |
static ByteBuf |
decode(ByteBuf src) |
static ByteBuf |
decode(ByteBuf src,
Base64Dialect dialect) |
static ByteBuf |
decode(ByteBuf src,
int off,
int len) |
static ByteBuf |
decode(ByteBuf src,
int off,
int len,
Base64Dialect dialect) |
static ByteBuf |
decode(ByteBuf src,
int off,
int len,
Base64Dialect dialect,
ByteBufAllocator allocator) |
private static int |
decode4to3(byte[] src,
int srcOffset,
ByteBuf dest,
int destOffset,
Base64Dialect dialect) |
static ByteBuf |
encode(ByteBuf src) |
static ByteBuf |
encode(ByteBuf src,
Base64Dialect dialect) |
static ByteBuf |
encode(ByteBuf src,
boolean breakLines) |
static ByteBuf |
encode(ByteBuf src,
boolean breakLines,
Base64Dialect dialect) |
static ByteBuf |
encode(ByteBuf src,
int off,
int len) |
static ByteBuf |
encode(ByteBuf src,
int off,
int len,
Base64Dialect dialect) |
static ByteBuf |
encode(ByteBuf src,
int off,
int len,
boolean breakLines) |
static ByteBuf |
encode(ByteBuf src,
int off,
int len,
boolean breakLines,
Base64Dialect dialect) |
static ByteBuf |
encode(ByteBuf src,
int off,
int len,
boolean breakLines,
Base64Dialect dialect,
ByteBufAllocator allocator) |
private static void |
encode3to4(ByteBuf src,
int srcOffset,
int numSigBytes,
ByteBuf dest,
int destOffset,
Base64Dialect dialect) |
private static final int MAX_LINE_LENGTH
private static final byte EQUALS_SIGN
private static final byte NEW_LINE
private static final byte WHITE_SPACE_ENC
private static final byte EQUALS_SIGN_ENC
private static byte[] alphabet(Base64Dialect dialect)
private static byte[] decodabet(Base64Dialect dialect)
private static boolean breakLines(Base64Dialect dialect)
public static ByteBuf encode(ByteBuf src, Base64Dialect dialect)
public static ByteBuf encode(ByteBuf src, boolean breakLines, Base64Dialect dialect)
public static ByteBuf encode(ByteBuf src, int off, int len, Base64Dialect dialect)
public static ByteBuf encode(ByteBuf src, int off, int len, boolean breakLines, Base64Dialect dialect)
public static ByteBuf encode(ByteBuf src, int off, int len, boolean breakLines, Base64Dialect dialect, ByteBufAllocator allocator)
private static void encode3to4(ByteBuf src, int srcOffset, int numSigBytes, ByteBuf dest, int destOffset, Base64Dialect dialect)
public static ByteBuf decode(ByteBuf src, Base64Dialect dialect)
public static ByteBuf decode(ByteBuf src, int off, int len, Base64Dialect dialect)
public static ByteBuf decode(ByteBuf src, int off, int len, Base64Dialect dialect, ByteBufAllocator allocator)
private static int decode4to3(byte[] src, int srcOffset, ByteBuf dest, int destOffset, Base64Dialect dialect)