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 | Class and Description |
---|---|
private static class |
Base64.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) |
(package private) static int |
decodedBufferSize(int len) |
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,
byte[] alphabet) |
private static void |
encode3to4BigEndian(int inBuff,
int numSigBytes,
ByteBuf dest,
int destOffset,
byte[] alphabet) |
private static void |
encode3to4LittleEndian(int inBuff,
int numSigBytes,
ByteBuf dest,
int destOffset,
byte[] alphabet) |
(package private) static int |
encodedBufferSize(int len,
boolean breakLines) |
private static int |
toInt(byte value) |
private static int |
toIntBE(int mediumValue) |
private static int |
toIntBE(short value) |
private static int |
toIntLE(int mediumValue) |
private static int |
toIntLE(short value) |
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, byte[] alphabet)
static int encodedBufferSize(int len, boolean breakLines)
private static int toInt(byte value)
private static int toIntBE(short value)
private static int toIntLE(short value)
private static int toIntBE(int mediumValue)
private static int toIntLE(int mediumValue)
private static void encode3to4BigEndian(int inBuff, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet)
private static void encode3to4LittleEndian(int inBuff, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet)
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)
static int decodedBufferSize(int len)