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

public final Class Base64

extends Object
Class Inheritance
Imports
io.netty5.buffer.Buffer, .BufferAllocator, io.netty5.util.ByteProcessor

Utility class for Buffer 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 Buffer
public static Buffer
decode(Buffer src, Base64Dialect dialect)

public static Buffer
decode(Buffer src, int off, int len)

public static Buffer
decode(Buffer src, int off, int len, Base64Dialect dialect)

public static Buffer
decode(Buffer src, int off, int len, Base64Dialect dialect, BufferAllocator allocator)

pack-priv static int
public static Buffer
public static Buffer
encode(Buffer src, Base64Dialect dialect)

public static Buffer
encode(Buffer src, boolean breakLines)

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

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

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

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

public static Buffer
encode(Buffer src, int off, int len, boolean breakLines, Base64Dialect dialect)

public static Buffer
encode(Buffer src, int off, int len, boolean breakLines, Base64Dialect dialect, BufferAllocator allocator)

private static void
encode3to4(Buffer src, int srcOffset, int numSigBytes, Buffer dest, int destOffset, byte[] alphabet)

private static void
encode3to4BigEndian(int inBuff, int numSigBytes, Buffer 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)

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 Buffer decode(Buffer src)
decodeback to summary
public static Buffer decode(Buffer src, Base64Dialect dialect)
decodeback to summary
public static Buffer decode(Buffer src, int off, int len)
decodeback to summary
public static Buffer decode(Buffer src, int off, int len, Base64Dialect dialect)
decodeback to summary
public static Buffer decode(Buffer src, int off, int len, Base64Dialect dialect, BufferAllocator allocator)
decodedBufferSizeback to summary
pack-priv static int decodedBufferSize(int len)
encodeback to summary
public static Buffer encode(Buffer src)
encodeback to summary
public static Buffer encode(Buffer src, Base64Dialect dialect)
encodeback to summary
public static Buffer encode(Buffer src, boolean breakLines)
encodeback to summary
public static Buffer encode(Buffer src, boolean breakLines, Base64Dialect dialect)
encodeback to summary
public static Buffer encode(Buffer src, int off, int len)
encodeback to summary
public static Buffer encode(Buffer src, int off, int len, Base64Dialect dialect)
encodeback to summary
public static Buffer encode(Buffer src, int off, int len, boolean breakLines)
encodeback to summary
public static Buffer encode(Buffer src, int off, int len, boolean breakLines, Base64Dialect dialect)
encodeback to summary
public static Buffer encode(Buffer src, int off, int len, boolean breakLines, Base64Dialect dialect, BufferAllocator allocator)
encode3to4back to summary
private static void encode3to4(Buffer src, int srcOffset, int numSigBytes, Buffer dest, int destOffset, byte[] alphabet)
encode3to4BigEndianback to summary
private static void encode3to4BigEndian(int inBuff, int numSigBytes, Buffer 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)
io.netty5.handler.codec.base64 back to summary

private final Class Base64.Decoder

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

Field Summary

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

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

private static int
decode4to3(byte[] src, Buffer 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 Buffer dest
outBuffPosnback to summary
private int outBuffPosn

Constructor Detail

Decoderback to summary
private Decoder()

Method Detail

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

Implements io.netty5.util.ByteProcessor.process.

Returns:boolean

Doc from io.netty5.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