org.apache.hadoop.hbase.io.encoding
Enum DataBlockEncoding

java.lang.Object
  extended by java.lang.Enum<DataBlockEncoding>
      extended by org.apache.hadoop.hbase.io.encoding.DataBlockEncoding
All Implemented Interfaces:
Serializable, Comparable<DataBlockEncoding>

@InterfaceAudience.Private
public enum DataBlockEncoding
extends Enum<DataBlockEncoding>

Provide access to all data block encoding algorithms. All of the algorithms are required to have unique id which should NEVER be changed. If you want to add a new algorithm/version, assign it a new id. Announce the new id in the HBase mailing list to prevent collisions.


Enum Constant Summary
DIFF
           
FAST_DIFF
           
NONE
          Disable data block encoding.
PREFIX
           
PREFIX_TREE
           
 
Field Summary
static int ID_SIZE
           
 
Method Summary
protected static DataBlockEncoder createEncoder(String fullyQualifiedClassName)
           
static DataBlockEncoder getDataBlockEncoderById(short encoderId)
          Find and create data block encoder for given id;
 DataBlockEncoder getEncoder()
          Return new data block encoder for given algorithm type.
static DataBlockEncoding getEncodingById(short dataBlockEncodingId)
           
 short getId()
           
static String getNameFromId(short encoderId)
          Find and return the name of data block encoder for the given id.
 byte[] getNameInBytes()
           
static boolean isCorrectEncoder(DataBlockEncoder encoder, short encoderId)
          Check if given encoder has this id.
static DataBlockEncoding valueOf(String name)
          Returns the enum constant of this type with the specified name.
static DataBlockEncoding[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 void writeIdInBytes(byte[] dest, int offset)
          Writes id bytes to the given array starting from offset.
 void writeIdInBytes(OutputStream stream)
          Writes id in bytes.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NONE

public static final DataBlockEncoding NONE
Disable data block encoding.


PREFIX

public static final DataBlockEncoding PREFIX

DIFF

public static final DataBlockEncoding DIFF

FAST_DIFF

public static final DataBlockEncoding FAST_DIFF

PREFIX_TREE

public static final DataBlockEncoding PREFIX_TREE
Field Detail

ID_SIZE

public static final int ID_SIZE
See Also:
Constant Field Values
Method Detail

values

public static DataBlockEncoding[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (DataBlockEncoding c : DataBlockEncoding.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static DataBlockEncoding valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getNameInBytes

public byte[] getNameInBytes()
Returns:
name converted to bytes.

getId

public short getId()
Returns:
The id of a data block encoder.

writeIdInBytes

public void writeIdInBytes(OutputStream stream)
                    throws IOException
Writes id in bytes.

Parameters:
stream - where the id should be written.
Throws:
IOException

writeIdInBytes

public void writeIdInBytes(byte[] dest,
                           int offset)
                    throws IOException
Writes id bytes to the given array starting from offset.

Parameters:
dest - output array
offset - starting offset of the output array
Throws:
IOException

getEncoder

public DataBlockEncoder getEncoder()
Return new data block encoder for given algorithm type.

Returns:
data block encoder if algorithm is specified, null if none is selected.

getDataBlockEncoderById

public static DataBlockEncoder getDataBlockEncoderById(short encoderId)
Find and create data block encoder for given id;

Parameters:
encoderId - id of data block encoder.
Returns:
Newly created data block encoder.

getNameFromId

public static String getNameFromId(short encoderId)
Find and return the name of data block encoder for the given id.

Parameters:
encoderId - id of data block encoder
Returns:
name, same as used in options in column family

isCorrectEncoder

public static boolean isCorrectEncoder(DataBlockEncoder encoder,
                                       short encoderId)
Check if given encoder has this id.

Parameters:
encoder - encoder which id will be checked
encoderId - id which we except
Returns:
true if id is right for given encoder, false otherwise
Throws:
IllegalArgumentException - thrown when there is no matching data block encoder

getEncodingById

public static DataBlockEncoding getEncodingById(short dataBlockEncodingId)

createEncoder

protected static DataBlockEncoder createEncoder(String fullyQualifiedClassName)


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