Class Base64

java.lang.Object
io.netty.handler.codec.base64.Base64

public final class Base64 extends Object
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.

  • Field Details

    • MAX_LINE_LENGTH

      private static final int MAX_LINE_LENGTH
      Maximum line length (76) of Base64 output.
      See Also:
    • EQUALS_SIGN

      private static final byte EQUALS_SIGN
      The equals sign (=) as a byte.
      See Also:
    • NEW_LINE

      private static final byte NEW_LINE
      The 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

      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)
    • encode

      public static ByteBuf encode(ByteBuf src, Base64Dialect dialect)
    • encode

      public static ByteBuf encode(ByteBuf src, boolean breakLines)
    • encode

      public static ByteBuf encode(ByteBuf src, boolean breakLines, Base64Dialect dialect)
    • encode

      public static ByteBuf encode(ByteBuf src, int off, int len)
    • 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)
    • 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)
    • decode

      public static ByteBuf decode(ByteBuf src, Base64Dialect dialect)
    • decode

      public static ByteBuf decode(ByteBuf src, int off, int len)
    • 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)