com.sleepycat.je.tree
Class Key

java.lang.Object
  extended by com.sleepycat.je.tree.Key
All Implemented Interfaces:
Comparable

public final class Key
extends Object
implements Comparable

Key represents a JE B-Tree Key. Keys are immutable. Within JE, keys are usually represented as byte arrays rather than as Key instances in order to reduce the in-memory footprint. The static methods of this class are used to operate on the byte arrays. One exception is when keys are held within a collection. In that case, Key objects are instantiated so that keys are hashed and compared by value.


Field Summary
static boolean DUMP_BINARY
           
static boolean DUMP_INT_BINDING
           
static byte[] EMPTY_KEY
           
 
Constructor Summary
Key(byte[] key)
          Construct a new key from a byte array.
 
Method Summary
static int compareKeys(byte[] key1, byte[] key2)
           
 int compareTo(Object o)
          Compare two keys.
static String dumpString(byte[] key, int nspaces)
           
 boolean equals(Object o)
          Support Set of Key in BINReference.
 byte[] getKey()
          Get the byte array for the key.
static String getNoFormatString(byte[] key)
          Print the string w/out XML format.
 int hashCode()
          Support HashSet of Key in BINReference.
static byte[] makeKey(DatabaseEntry dbt)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUMP_BINARY

public static boolean DUMP_BINARY

DUMP_INT_BINDING

public static boolean DUMP_INT_BINDING

EMPTY_KEY

public static final byte[] EMPTY_KEY
Constructor Detail

Key

public Key(byte[] key)
Construct a new key from a byte array.

Method Detail

makeKey

public static byte[] makeKey(DatabaseEntry dbt)

getKey

public byte[] getKey()
Get the byte array for the key.


compareTo

public int compareTo(Object o)
Compare two keys. Standard compareTo function and returns.

Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object o)
Support Set of Key in BINReference.

Overrides:
equals in class Object

hashCode

public int hashCode()
Support HashSet of Key in BINReference.

Overrides:
hashCode in class Object

compareKeys

public static int compareKeys(byte[] key1,
                              byte[] key2)

dumpString

public static String dumpString(byte[] key,
                                int nspaces)

getNoFormatString

public static String getNoFormatString(byte[] key)
Print the string w/out XML format.



Copyright 2004-2005 Sleepycat, Inc. All Rights Reserved.