| Modifier and Type | Field and Description |
|---|---|
protected int |
lineLength
Chunksize for encoding.
|
protected static int |
MASK_8BITS
Mask used to extract 8 bits, used in decoding bytes
|
protected byte |
pad |
protected static byte |
PAD_DEFAULT
Byte used to pad output.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BaseNCodec(int unencodedBlockSize,
int encodedBlockSize,
int lineLength,
int chunkSeparatorLength)
Note
lineLength is rounded down to the nearest multiple of encodedBlockSize
If chunkSeparatorLength is zero, then chunking is disabled. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decode(byte[] pArray)
Decodes a byte[] containing characters in the Base-N alphabet.
|
byte[] |
decode(String pArray)
Decodes a String containing characters in the Base-N alphabet.
|
byte[] |
encode(byte[] pArray)
Encodes a byte[] containing binary data, into a byte[] containing characters in the alphabet.
|
String |
encodeAsString(byte[] pArray)
Encodes a byte[] containing binary data, into a String containing characters in the appropriate alphabet.
|
protected abstract boolean |
isInAlphabet(byte value)
Returns whether or not the
octet is in the current alphabet. |
protected static boolean |
isWhiteSpace(byte byteToCheck)
Checks if a byte value is whitespace or not.
|
protected static final int MASK_8BITS
protected static final byte PAD_DEFAULT
protected final byte pad
protected final int lineLength
protected BaseNCodec(int unencodedBlockSize,
int encodedBlockSize,
int lineLength,
int chunkSeparatorLength)
lineLength is rounded down to the nearest multiple of encodedBlockSize
If chunkSeparatorLength is zero, then chunking is disabled.unencodedBlockSize - the size of an unencoded block (e.g. Base64 = 3)encodedBlockSize - the size of an encoded block (e.g. Base64 = 4)lineLength - if > 0, use chunking with a length lineLengthchunkSeparatorLength - the chunk separator length, if relevantprotected static boolean isWhiteSpace(byte byteToCheck)
byteToCheck - the byte to checkpublic String encodeAsString(byte[] pArray)
pArray - a byte array containing binary datapublic byte[] decode(String pArray)
pArray - A String containing Base-N character datapublic byte[] decode(byte[] pArray)
pArray - A byte array containing Base-N character datapublic byte[] encode(byte[] pArray)
pArray - a byte array containing binary dataprotected abstract boolean isInAlphabet(byte value)
octet is in the current alphabet.
Does not allow whitespace or pad.value - The value to testtrue if the value is defined in the current alphabet, false otherwise.Copyright © 2012–2022. All rights reserved.