Package com.jsql.util.bruter
Class Base16
java.lang.Object
com.jsql.util.bruter.BaseNCodec
com.jsql.util.bruter.Base16
- All Implemented Interfaces:
org.apache.commons.codec.BinaryDecoder
,org.apache.commons.codec.BinaryEncoder
,org.apache.commons.codec.Decoder
,org.apache.commons.codec.Encoder
Provides Base16 encoding and decoding.
This class is thread-safe.
This implementation strictly follows RFC 4648, and as such unlike
the Base32
and Base64
implementations,
it does not ignore invalid alphabet characters or whitespace,
neither does it offer chunking or padding characters.
The only additional feature above those specified in RFC 4648 is support for working with a lower-case alphabet in addition to the default upper-case alphabet.
- Since:
- 1.15
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jsql.util.bruter.BaseNCodec
BaseNCodec.Context
-
Field Summary
Fields inherited from class com.jsql.util.bruter.BaseNCodec
DECODING_POLICY_DEFAULT, lineLength, MASK_8BITS, MIME_CHUNK_SIZE, pad, PAD_DEFAULT, PEM_CHUNK_SIZE
-
Constructor Summary
ConstructorDescriptionBase16()
Creates a Base16 codec used for decoding and encoding.Base16
(boolean lowerCase) Creates a Base16 codec used for decoding and encoding.Base16
(boolean lowerCase, CodecPolicy decodingPolicy) Creates a Base16 codec used for decoding and encoding. -
Method Summary
Modifier and TypeMethodDescriptionvoid
decode
(byte[] data, int offsetInput, int length, BaseNCodec.Context context) void
encode
(byte[] data, int offset, int length, BaseNCodec.Context context) boolean
isInAlphabet
(byte octet) Returns whether theoctet
is in the Base16 alphabet.Methods inherited from class com.jsql.util.bruter.BaseNCodec
containsAlphabetOrPad, decode, decode, decode, encode, encode, encode, encodeAsString, encodeToString, ensureBufferSize, getChunkSeparator, getCodecPolicy, getDefaultBufferSize, getEncodedLength, hasData, isInAlphabet, isInAlphabet, isStrictDecoding, isWhiteSpace
-
Constructor Details
-
Base16
public Base16()Creates a Base16 codec used for decoding and encoding. -
Base16
public Base16(boolean lowerCase) Creates a Base16 codec used for decoding and encoding.- Parameters:
lowerCase
- iftrue
then use a lower-case Base16 alphabet.
-
Base16
Creates a Base16 codec used for decoding and encoding.- Parameters:
lowerCase
- iftrue
then use a lower-case Base16 alphabet.decodingPolicy
- Decoding policy.
-
-
Method Details
-
decode
- Specified by:
decode
in classBaseNCodec
-
encode
- Specified by:
encode
in classBaseNCodec
-
isInAlphabet
public boolean isInAlphabet(byte octet) Returns whether theoctet
is in the Base16 alphabet.- Specified by:
isInAlphabet
in classBaseNCodec
- Parameters:
octet
- The value to test.- Returns:
true
if the value is defined in the the Base16 alphabetfalse
otherwise.
-