org.apache.hadoop.hbase.io.util
Interface Dictionary

All Known Implementing Classes:
LRUDictionary

@InterfaceAudience.Private
public interface Dictionary

Dictionary interface Dictionary indexes should be either bytes or shorts, only positive. (The first bit is reserved for detecting whether something is compressed or not).


Field Summary
static byte NOT_IN_DICTIONARY
           
 
Method Summary
 short addEntry(byte[] data, int offset, int length)
          Adds an entry to the dictionary.
 void clear()
          Flushes the dictionary, empties all values.
 short findEntry(byte[] data, int offset, int length)
          Finds the index of an entry.
 byte[] getEntry(short idx)
          Gets an entry from the dictionary.
 void init(int initialSize)
           
 

Field Detail

NOT_IN_DICTIONARY

static final byte NOT_IN_DICTIONARY
See Also:
Constant Field Values
Method Detail

init

void init(int initialSize)

getEntry

byte[] getEntry(short idx)
Gets an entry from the dictionary.

Parameters:
idx - index of the entry
Returns:
the entry, or null if non existent

findEntry

short findEntry(byte[] data,
                int offset,
                int length)
Finds the index of an entry. If no entry found, we add it.

Parameters:
data - the byte array that we're looking up
offset - Offset into data to add to Dictionary.
length - Length beyond offset that comprises entry; must be > 0.
Returns:
the index of the entry, or NOT_IN_DICTIONARY if not found

addEntry

short addEntry(byte[] data,
               int offset,
               int length)
Adds an entry to the dictionary. Be careful using this method. It will add an entry to the dictionary even if it already has an entry for the same data. Call {findEntry(byte[], int, int)} to add without duplicating dictionary entries.

Parameters:
data - the entry to add
offset - Offset into data to add to Dictionary.
length - Length beyond offset that comprises entry; must be > 0.
Returns:
the index of the entry

clear

void clear()
Flushes the dictionary, empties all values.



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