@InterfaceAudience.Public @InterfaceStability.Stable public enum XAttrCodec extends Enum<XAttrCodec>
XAttr
is byte[], this class is to
covert byte[] to some kind of string representation or convert back.
String representation is convenient for display and input. For example
display in screen as shell response and json response, input as http
or shell parameter.Enum Constant and Description |
---|
BASE64
Value encoded as base64 string
is prefixed with 0s.
|
HEX
Value encoded as hexadecimal string
is prefixed with 0x.
|
TEXT
Value encoded as text
string is enclosed in double quotes (\").
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
decodeValue(String value)
Decode string representation of a value and check whether it's
encoded.
|
static String |
encodeValue(byte[] value,
XAttrCodec encoding)
Encode byte[] value to string representation with encoding.
|
static XAttrCodec |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static XAttrCodec[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final XAttrCodec TEXT
public static final XAttrCodec HEX
public static final XAttrCodec BASE64
public static XAttrCodec[] values()
for (XAttrCodec c : XAttrCodec.values()) System.out.println(c);
public static XAttrCodec valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant
with the specified nameNullPointerException
- if the argument is nullpublic static byte[] decodeValue(String value) throws IOException
value
- string representation of the value.IOException
public static String encodeValue(byte[] value, XAttrCodec encoding) throws IOException
value
- byte[] valueencoding
- IOException
Copyright © 2016 Apache Software Foundation. All Rights Reserved.