public class HBaseByteInterface extends Object
Modifier and Type | Field and Description |
---|---|
static ThreadLocal<org.apache.avro.io.BinaryDecoder> |
decoders |
static ThreadLocal<org.apache.avro.io.BinaryEncoder> |
encoders |
static ConcurrentHashMap<String,org.apache.avro.specific.SpecificDatumReader<?>> |
readerMap |
static ConcurrentHashMap<String,org.apache.avro.specific.SpecificDatumWriter<?>> |
writerMap |
Constructor and Description |
---|
HBaseByteInterface() |
Modifier and Type | Method and Description |
---|---|
static <K> K |
fromBytes(Class<K> clazz,
byte[] val)
Converts an array of bytes to the target basic class.
|
static Object |
fromBytes(org.apache.avro.Schema schema,
byte[] val)
Deserializes an array of bytes matching the given schema to the proper basic
(enum, Utf8,...) or complex type (Persistent/Record).
|
static byte[] |
toBytes(Object o)
Converts an instance of a basic class to an array of bytes.
|
static byte[] |
toBytes(Object o,
org.apache.avro.Schema schema)
Serializes an object following the given schema.
|
public static final ThreadLocal<org.apache.avro.io.BinaryDecoder> decoders
public static final ThreadLocal<org.apache.avro.io.BinaryEncoder> encoders
public static final ConcurrentHashMap<String,org.apache.avro.specific.SpecificDatumReader<?>> readerMap
public static final ConcurrentHashMap<String,org.apache.avro.specific.SpecificDatumWriter<?>> writerMap
public static Object fromBytes(org.apache.avro.Schema schema, byte[] val) throws IOException
arrays/maps
if not inside a record
type.schema
- Avro schema describing the expected dataval
- array of bytes with the data serializedIOException
public static <K> K fromBytes(Class<K> clazz, byte[] val)
clazz
- (Byte|Boolean|Short|Integer|Long|Float|Double|String|Utf8).classval
- array of bytes with the valueclazz
with the bytes in val
deserialized with org.apache.hadoop.hbase.util.Bytespublic static byte[] toBytes(Object o)
o
- Instance of Enum|Byte|Boolean|Short|Integer|Long|Float|Double|String|Utf8o
serialized with org.apache.hadoop.hbase.util.Bytespublic static byte[] toBytes(Object o, org.apache.avro.Schema schema) throws IOException
array/map
if it is not inside a record
o
- Utf8|ByteBuffer|Integer|Long|Float|Double|Boolean|Enum|Persistentschema
- The schema describing the object (or a compatible description)IOException
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.