| Modifier and Type | Method and Description |
|---|---|
T |
fromBytes(byte[] bytes) |
T |
fromSmile(byte[] bytes)
Converts the specified smile bytes (UTF-8) into an instance of type T.
|
Type |
getType()
Gets the type this codec supports.
|
static <T> SmileCodec<List<T>> |
listSmileCodec(Class<T> type) |
static <T> SmileCodec<List<T>> |
listSmileCodec(SmileCodec<T> type) |
static <K,V> SmileCodec<Map<K,V>> |
mapSmileCodec(Class<K> keyType,
Class<V> valueType) |
static <K,V> SmileCodec<Map<K,V>> |
mapSmileCodec(Class<K> keyType,
SmileCodec<V> valueType) |
T |
readBytes(InputStream input) |
static <T> SmileCodec<T> |
smileCodec(Class<T> type) |
static <T> SmileCodec<T> |
smileCodec(com.google.common.reflect.TypeToken<T> type) |
byte[] |
toBytes(T instance) |
byte[] |
toSmile(T instance)
Converts the specified instance to smile encoded bytes.
|
void |
writeBytes(OutputStream output,
T instance) |
public static <T> SmileCodec<T> smileCodec(Class<T> type)
public static <T> SmileCodec<T> smileCodec(com.google.common.reflect.TypeToken<T> type)
public static <T> SmileCodec<List<T>> listSmileCodec(Class<T> type)
public static <T> SmileCodec<List<T>> listSmileCodec(SmileCodec<T> type)
public static <K,V> SmileCodec<Map<K,V>> mapSmileCodec(Class<K> keyType, Class<V> valueType)
public static <K,V> SmileCodec<Map<K,V>> mapSmileCodec(Class<K> keyType, SmileCodec<V> valueType)
public Type getType()
public T fromSmile(byte[] bytes) throws IllegalArgumentException
bytes - the bytes (UTF-8) to parseIllegalArgumentException - if the bytes bytes can not be converted to the type Tpublic byte[] toSmile(T instance) throws IllegalArgumentException
instance - the instance to convert to smile encoded bytesIllegalArgumentException - if the specified instance can not be converted to smilepublic void writeBytes(OutputStream output, T instance)
writeBytes in interface Codec<T>public T readBytes(InputStream input)
Copyright © 2010–2024 Airlift. All rights reserved.