Top Description Inners Fields Constructors Methods
io.netty.handler.codec.base64

public final Class Base64

extends Object
Class Inheritance
Imports
io.netty.buffer.ByteBuf, .ByteBufAllocator, io.netty.util.ByteProcessor, io.netty.util.internal.ObjectUtil, .PlatformDependent, java.nio.ByteOrder

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 and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final byte
EQUALS_SIGN

The equals sign (=) as a byte.

private static final byte
private static final int
MAX_LINE_LENGTH

Maximum line length (76) of Base64 output.

private static final byte
NEW_LINE

The new line character (\n) as a byte.

private static final byte

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static byte[]
private static boolean
private static byte[]
public static ByteBuf
public static ByteBuf
public static ByteBuf
decode(ByteBuf src, int off, int len)

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)

pack-priv static int
public static ByteBuf
public static ByteBuf
public static ByteBuf
encode(ByteBuf src, boolean breakLines)

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

public static ByteBuf
encode(ByteBuf src, int off, int len)

public static ByteBuf
encode(ByteBuf src, int off, int len, Base64Dialect dialect)

public static ByteBuf
encode(ByteBuf src, int off, int len, boolean breakLines)

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)

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)

pack-priv static int
encodedBufferSize(int len, boolean breakLines)

private static int
toInt(byte value)

private static int
toIntBE(short value)

private static int
toIntBE(int mediumValue)

private static int
toIntLE(short value)

private static int
toIntLE(int mediumValue)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EQUALS_SIGNback to summary
private static final byte EQUALS_SIGN

The equals sign (=) as a byte.

EQUALS_SIGN_ENCback to summary
private static final byte EQUALS_SIGN_ENC
MAX_LINE_LENGTHback to summary
private static final int MAX_LINE_LENGTH

Maximum line length (76) of Base64 output.

NEW_LINEback to summary
private static final byte NEW_LINE

The new line character (\n) as a byte.

WHITE_SPACE_ENCback to summary
private static final byte WHITE_SPACE_ENC

Constructor Detail

Base64back to summary
private Base64()

Method Detail

alphabetback to summary
private static byte[] alphabet(Base64Dialect dialect)
breakLinesback to summary
private static boolean breakLines(Base64Dialect dialect)
decodabetback to summary
private static byte[] decodabet(Base64Dialect dialect)
decodeback to summary
public static ByteBuf decode(ByteBuf src)
decodeback to summary
public static ByteBuf decode(ByteBuf src, Base64Dialect dialect)
decodeback to summary
public static ByteBuf decode(ByteBuf src, int off, int len)
decodeback to summary
public static ByteBuf decode(ByteBuf src, int off, int len, Base64Dialect dialect)
decodeback to summary
public static ByteBuf decode(ByteBuf src, int off, int len, Base64Dialect dialect, ByteBufAllocator allocator)
decodedBufferSizeback to summary
pack-priv static int decodedBufferSize(int len)
encodeback to summary
public static ByteBuf encode(ByteBuf src)
encodeback to summary
public static ByteBuf encode(ByteBuf src, Base64Dialect dialect)
encodeback to summary
public static ByteBuf encode(ByteBuf src, boolean breakLines)
encodeback to summary
public static ByteBuf encode(ByteBuf src, boolean breakLines, Base64Dialect dialect)
encodeback to summary
public static ByteBuf encode(ByteBuf src, int off, int len)
encodeback to summary
public static ByteBuf encode(ByteBuf src, int off, int len, Base64Dialect dialect)
encodeback to summary
public static ByteBuf encode(ByteBuf src, int off, int len, boolean breakLines)
encodeback to summary
public static ByteBuf encode(ByteBuf src, int off, int len, boolean breakLines, Base64Dialect dialect)
encodeback to summary
public static ByteBuf encode(ByteBuf src, int off, int len, boolean breakLines, Base64Dialect dialect, ByteBufAllocator allocator)
encode3to4back to summary
private static void encode3to4(ByteBuf src, int srcOffset, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet)
encode3to4BigEndianback to summary
private static void encode3to4BigEndian(int inBuff, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet)
encode3to4LittleEndianback to summary
private static void encode3to4LittleEndian(int inBuff, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet)
encodedBufferSizeback to summary
pack-priv static int encodedBufferSize(int len, boolean breakLines)
toIntback to summary
private static int toInt(byte value)
toIntBEback to summary
private static int toIntBE(short value)
toIntBEback to summary
private static int toIntBE(int mediumValue)
toIntLEback to summary
private static int toIntLE(short value)
toIntLEback to summary
private static int toIntLE(int mediumValue)
io.netty.handler.codec.base64 back to summary

private final Class Base64.Decoder

extends Object
implements ByteProcessor
Class Inheritance
All Implemented Interfaces
io.netty.util.ByteProcessor

Field Summary

Modifier and TypeField and Description
private final byte[]
private int
private byte[]
private ByteBuf
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv ByteBuf
decode(ByteBuf src, int off, int len, ByteBufAllocator allocator, Base64Dialect dialect)

private static int
decode4to3(byte[] src, ByteBuf dest, int destOffset, byte[] decodabet)

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

b4back to summary
private final byte[] b4
b4Posnback to summary
private int b4Posn
decodabetback to summary
private byte[] decodabet
destback to summary
private ByteBuf dest
outBuffPosnback to summary
private int outBuffPosn

Constructor Detail

Decoderback to summary
private Decoder()

Method Detail

decodeback to summary
pack-priv ByteBuf decode(ByteBuf src, int off, int len, ByteBufAllocator allocator, Base64Dialect dialect)
decode4to3back to summary
private static int decode4to3(byte[] src, ByteBuf dest, int destOffset, byte[] decodabet)
processback to summary
public boolean process(byte value) throws Exception

Implements io.netty.util.ByteProcessor.process.

Returns:boolean

Doc from io.netty.util.ByteProcessor.process.

true if the processor wants to continue the loop and handle the next byte in the buffer. false if the processor wants to stop handling bytes and abort the loop.

Annotations
@Override