Package io.netty.handler.codec.base64
Class Base64
java.lang.Object
io.netty.handler.codec.base64.Base64
Utility class for
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final byte
The equals sign (=) as a byte.private static final byte
private static final int
Maximum line length (76) of Base64 output.private static final byte
The new line character (\n) as a byte.private static final byte
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static byte[]
alphabet
(Base64Dialect dialect) private static boolean
breakLines
(Base64Dialect dialect) private static byte[]
decodabet
(Base64Dialect dialect) static ByteBuf
static ByteBuf
static ByteBuf
decode
(ByteBuf src, int off, int len, Base64Dialect dialect) static ByteBuf
decode
(ByteBuf src, int off, int len, Base64Dialect dialect, ByteBufAllocator allocator) static ByteBuf
decode
(ByteBuf src, Base64Dialect dialect) (package private) static int
decodedBufferSize
(int len) static ByteBuf
static ByteBuf
static ByteBuf
encode
(ByteBuf src, boolean breakLines, Base64Dialect dialect) static ByteBuf
static ByteBuf
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) static ByteBuf
encode
(ByteBuf src, int off, int len, Base64Dialect dialect) static ByteBuf
encode
(ByteBuf src, Base64Dialect dialect) 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)
-
Field Details
-
MAX_LINE_LENGTH
private static final int MAX_LINE_LENGTHMaximum line length (76) of Base64 output.- See Also:
-
EQUALS_SIGN
private static final byte EQUALS_SIGNThe equals sign (=) as a byte.- See Also:
-
NEW_LINE
private static final byte NEW_LINEThe new line character (\n) as a byte.- See Also:
-
WHITE_SPACE_ENC
private static final byte WHITE_SPACE_ENC- See Also:
-
EQUALS_SIGN_ENC
private static final byte EQUALS_SIGN_ENC- See Also:
-
-
Constructor Details
-
Base64
private Base64()
-
-
Method Details
-
alphabet
-
decodabet
-
breakLines
-
encode
-
encode
-
encode
-
encode
-
encode
-
encode
-
encode
-
encode
public static ByteBuf encode(ByteBuf src, int off, int len, boolean breakLines, Base64Dialect dialect) -
encode
public static ByteBuf encode(ByteBuf src, int off, int len, boolean breakLines, Base64Dialect dialect, ByteBufAllocator allocator) -
encode3to4
-
encodedBufferSize
static int encodedBufferSize(int len, boolean breakLines) -
toInt
private static int toInt(byte value) -
toIntBE
private static int toIntBE(short value) -
toIntLE
private static int toIntLE(short value) -
toIntBE
private static int toIntBE(int mediumValue) -
toIntLE
private static int toIntLE(int mediumValue) -
encode3to4BigEndian
private static void encode3to4BigEndian(int inBuff, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet) -
encode3to4LittleEndian
private static void encode3to4LittleEndian(int inBuff, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet) -
decode
-
decode
-
decode
-
decode
-
decode
public static ByteBuf decode(ByteBuf src, int off, int len, Base64Dialect dialect, ByteBufAllocator allocator) -
decodedBufferSize
static int decodedBufferSize(int len)
-