Package io.netty.handler.codec.base64
Class Base64
- java.lang.Object
-
- io.netty.handler.codec.base64.Base64
-
public final class Base64 extends java.lang.ObjectUtility class forByteBufthat 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 Modifier and Type Class Description private static classBase64.Decoder
-
Field Summary
Fields Modifier and Type Field Description private static byteEQUALS_SIGNThe equals sign (=) as a byte.private static byteEQUALS_SIGN_ENCprivate static intMAX_LINE_LENGTHMaximum line length (76) of Base64 output.private static byteNEW_LINEThe new line character (\n) as a byte.private static byteWHITE_SPACE_ENC
-
Constructor Summary
Constructors Modifier Constructor Description privateBase64()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static byte[]alphabet(Base64Dialect dialect)private static booleanbreakLines(Base64Dialect dialect)private static byte[]decodabet(Base64Dialect dialect)static ByteBufdecode(ByteBuf src)static ByteBufdecode(ByteBuf src, int off, int len)static ByteBufdecode(ByteBuf src, int off, int len, Base64Dialect dialect)static ByteBufdecode(ByteBuf src, int off, int len, Base64Dialect dialect, ByteBufAllocator allocator)static ByteBufdecode(ByteBuf src, Base64Dialect dialect)(package private) static intdecodedBufferSize(int len)static ByteBufencode(ByteBuf src)static ByteBufencode(ByteBuf src, boolean breakLines)static ByteBufencode(ByteBuf src, boolean breakLines, Base64Dialect dialect)static ByteBufencode(ByteBuf src, int off, int len)static ByteBufencode(ByteBuf src, int off, int len, boolean breakLines)static ByteBufencode(ByteBuf src, int off, int len, boolean breakLines, Base64Dialect dialect)static ByteBufencode(ByteBuf src, int off, int len, boolean breakLines, Base64Dialect dialect, ByteBufAllocator allocator)static ByteBufencode(ByteBuf src, int off, int len, Base64Dialect dialect)static ByteBufencode(ByteBuf src, Base64Dialect dialect)private static voidencode3to4(ByteBuf src, int srcOffset, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet)private static voidencode3to4BigEndian(int inBuff, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet)private static voidencode3to4LittleEndian(int inBuff, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet)(package private) static intencodedBufferSize(int len, boolean breakLines)private static inttoInt(byte value)private static inttoIntBE(int mediumValue)private static inttoIntBE(short value)private static inttoIntLE(int mediumValue)private static inttoIntLE(short value)
-
-
-
Field Detail
-
MAX_LINE_LENGTH
private static final int MAX_LINE_LENGTH
Maximum line length (76) of Base64 output.- See Also:
- Constant Field Values
-
EQUALS_SIGN
private static final byte EQUALS_SIGN
The equals sign (=) as a byte.- See Also:
- Constant Field Values
-
NEW_LINE
private static final byte NEW_LINE
The new line character (\n) as a byte.- See Also:
- Constant Field Values
-
WHITE_SPACE_ENC
private static final byte WHITE_SPACE_ENC
- See Also:
- Constant Field Values
-
EQUALS_SIGN_ENC
private static final byte EQUALS_SIGN_ENC
- See Also:
- Constant Field Values
-
-
Method Detail
-
alphabet
private static byte[] alphabet(Base64Dialect dialect)
-
decodabet
private static byte[] decodabet(Base64Dialect dialect)
-
breakLines
private static boolean breakLines(Base64Dialect dialect)
-
encode
public static ByteBuf encode(ByteBuf src, Base64Dialect dialect)
-
encode
public static ByteBuf encode(ByteBuf src, boolean breakLines, Base64Dialect dialect)
-
encode
public static ByteBuf encode(ByteBuf src, int off, int len, Base64Dialect dialect)
-
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
private static void encode3to4(ByteBuf src, int srcOffset, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet)
-
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
public static ByteBuf decode(ByteBuf src, Base64Dialect dialect)
-
decode
public static ByteBuf decode(ByteBuf src, int off, int len, Base64Dialect dialect)
-
decode
public static ByteBuf decode(ByteBuf src, int off, int len, Base64Dialect dialect, ByteBufAllocator allocator)
-
decodedBufferSize
static int decodedBufferSize(int len)
-
-