org.apache.hadoop.hbase.protobuf
Class ProtobufUtil

java.lang.Object
  extended by org.apache.hadoop.hbase.protobuf.ProtobufUtil

public final class ProtobufUtil
extends Object

Protobufs utility.


Field Summary
static byte[] PB_MAGIC
          Magic we put ahead of a serialized protobuf message.
 
Method Summary
static boolean isPBMagicPrefix(byte[] bytes)
           
static int lengthOfPBMagic()
           
static byte[] prependPBMagic(byte[] bytes)
          Prepend the passed bytes with four bytes of magic, PB_MAGIC, to flag what follows as a protobuf in hbase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PB_MAGIC

public static final byte[] PB_MAGIC
Magic we put ahead of a serialized protobuf message. For example, all znode content is protobuf messages with the below magic for preamble.

Method Detail

prependPBMagic

public static byte[] prependPBMagic(byte[] bytes)
Prepend the passed bytes with four bytes of magic, PB_MAGIC, to flag what follows as a protobuf in hbase. Prepend these bytes to all content written to znodes, etc.

Parameters:
bytes - Bytes to decorate
Returns:
The passed bytes with magic prepended (Creates a new byte array that is bytes.length plus PB_MAGIC.length.

isPBMagicPrefix

public static boolean isPBMagicPrefix(byte[] bytes)
Parameters:
bytes - Bytes to check.
Returns:
True if passed bytes has PB_MAGIC for a prefix.

lengthOfPBMagic

public static int lengthOfPBMagic()
Returns:
Length of PB_MAGIC


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.