java.io.Serializable, java.lang.Comparable<XAttrCodec>@Public @Stable public enum XAttrCodec extends java.lang.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 | 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 | Description |
|---|---|---|
static byte[] |
decodeValue(java.lang.String value) |
Decode string representation of a value and check whether it's
encoded.
|
static java.lang.String |
encodeValue(byte[] value,
XAttrCodec encoding) |
Encode byte[] value to string representation with encoding.
|
static XAttrCodec |
valueOf(java.lang.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(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 nullpublic static byte[] decodeValue(java.lang.String value)
throws java.io.IOException
value - string representation of the value.java.io.IOException - raised on errors performing I/O.public static java.lang.String encodeValue(byte[] value,
XAttrCodec encoding)
throws java.io.IOException
value - byte[] valueencoding - encoding.java.io.IOException - raised on errors performing I/O.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.