Package org.wildfly.common.codec
Class Alphabet
- java.lang.Object
-
- org.wildfly.common.codec.Alphabet
-
- Direct Known Subclasses:
Base32Alphabet
,Base64Alphabet
public abstract class Alphabet extends java.lang.Object
A base-n encoder/decoder alphabet. Alphabets may be little-endian or big-endian. Each base has its own subclass.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
decode(int codePoint)
Decode the given code point (character).abstract int
encode(int val)
Encode the given byte value to a code point.boolean
isLittleEndian()
Determine whether this is a little-endian or big-endian alphabet.
-
-
-
Method Detail
-
isLittleEndian
public boolean isLittleEndian()
Determine whether this is a little-endian or big-endian alphabet.- Returns:
true
if the alphabet is little-endian,false
if it is big-endian
-
encode
public abstract int encode(int val)
Encode the given byte value to a code point.- Parameters:
val
- the value- Returns:
- the Unicode code point
-
decode
public abstract int decode(int codePoint)
Decode the given code point (character). If the code point is not valid, -1 is returned.- Parameters:
codePoint
- the Unicode code point- Returns:
- the decoded value or -1 if the code point is not valid
-
-