public final class CoderUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
KIND_PAIR
Coder class-name alias for a key-value type.
|
static String |
KIND_STREAM
Coder class-name alias for a stream type.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
clone(Coder<T> coder,
T value)
Clones the given value by encoding and then decoding it with the specified Coder.
|
static <T> T |
decodeFromBase64(Coder<T> coder,
String encodedValue)
Parses a value from a base64-encoded String using the given coder.
|
static <T> T |
decodeFromByteArray(Coder<T> coder,
byte[] encodedValue)
Decodes the given bytes using the specified Coder, and returns
the resulting decoded value.
|
static <T> T |
decodeFromByteArray(Coder<T> coder,
byte[] encodedValue,
Coder.Context context) |
static <T> String |
encodeToBase64(Coder<T> coder,
T value)
Encodes the given value using the specified Coder, and returns the Base64 encoding of the
encoded bytes.
|
static <T> byte[] |
encodeToByteArray(Coder<T> coder,
T value)
Encodes the given value using the specified Coder, and returns
the encoded bytes.
|
static <T> byte[] |
encodeToByteArray(Coder<T> coder,
T value,
Coder.Context context) |
static TypeDescriptor |
getCodedType(TypeDescriptor coderDescriptor)
If
coderType is a subclass of Coder<T> for a specific
type T, returns T.class. |
static CloudObject |
makeCloudEncoding(String type,
CloudObject... componentSpecs) |
public static final String KIND_PAIR
public static final String KIND_STREAM
public static <T> byte[] encodeToByteArray(Coder<T> coder, T value) throws CoderException
This function is not reentrant; it should not be called from methods of the provided
Coder.
CoderExceptionpublic static <T> byte[] encodeToByteArray(Coder<T> coder, T value, Coder.Context context) throws CoderException
CoderExceptionpublic static <T> T decodeFromByteArray(Coder<T> coder, byte[] encodedValue) throws CoderException
CoderExceptionpublic static <T> T decodeFromByteArray(Coder<T> coder, byte[] encodedValue, Coder.Context context) throws CoderException
CoderExceptionpublic static <T> T clone(Coder<T> coder, T value) throws CoderException
This function is not reentrant; it should not be called from methods of the provided
Coder.
CoderExceptionpublic static <T> String encodeToBase64(Coder<T> coder, T value) throws CoderException
CoderException - if there are errors during encoding.public static <T> T decodeFromBase64(Coder<T> coder, String encodedValue) throws CoderException
CoderExceptionpublic static TypeDescriptor getCodedType(TypeDescriptor coderDescriptor)
coderType is a subclass of Coder<T> for a specific
type T, returns T.class.public static CloudObject makeCloudEncoding(String type, CloudObject... componentSpecs)