public enum CodecUtils extends java.lang.Enum<CodecUtils>
Modifier and Type | Method and Description |
---|---|
(package private) static int |
sanitize(java.lang.String singleOctets,
byte[] dest)
Transforms the given string into the given destination byte array
truncating each character into a byte and skipping carriage returns and
line feeds if any.
|
(package private) static void |
sanityCheckLastPos(int pos,
int mask)
Sanity check the last decoded position is a possible value.
|
static byte[] |
toBytesDirect(java.lang.String singleOctets)
Returns a byte array representing the given string,
truncating each character into a byte directly.
|
static java.lang.String |
toStringDirect(byte[] bytes)
Returns a string representing the given byte array,
treating each byte as a single octet character.
|
static CodecUtils |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static CodecUtils[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static CodecUtils[] values()
for (CodecUtils c : CodecUtils.values()) System.out.println(c);
public static CodecUtils valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullstatic int sanitize(java.lang.String singleOctets, byte[] dest)
dmurray: "It so happens that we're currently only calling this method with src.length == dest.length, in which case it works, but we could theoretically get away with passing a smaller dest if we knew ahead of time that src contained some number of spaces. In that case it looks like this implementation would truncate the result."
hchar: "Yes, but the truncation is the intentional behavior of this internal routine in that case."
singleOctets
- non-null string containing only single octet charactersdest
- destination byte arrayjava.lang.IllegalArgumentException
- if the input string contains any multi-octet characterpublic static byte[] toBytesDirect(java.lang.String singleOctets)
java.lang.IllegalArgumentException
- if the input string contains any multi-octet characterpublic static java.lang.String toStringDirect(byte[] bytes)
static void sanityCheckLastPos(int pos, int mask)
java.lang.IllegalArgumentException
- if the given decoded position is
not a possible value produced via the respective encoding