com.sleepycat.je.tree
Class Key

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

public final class Key
extends java.lang.Object
implements java.lang.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.


Nested Class Summary
static class Key.DumpType
           
 
Field Summary
static boolean DUMP_INT_BINDING
           
static Key.DumpType DUMP_TYPE
           
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, java.util.Comparator comparator)
          Compare keys with an optional comparator.
 int compareTo(java.lang.Object o)
          Compare two keys.
static java.lang.String dumpString(byte[] key, int nspaces)
           
 boolean equals(java.lang.Object o)
          Support Set of Key in BINReference.
 byte[] getKey()
          Get the byte array for the key.
static java.lang.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_TYPE

public static Key.DumpType DUMP_TYPE

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(java.lang.Object o)
Compare two keys. Standard compareTo function and returns. Note that any configured user comparison function is not used, and therefore this method should not be used for comparison of keys during Btree operations.

Specified by:
compareTo in interface java.lang.Comparable

equals

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

Overrides:
equals in class java.lang.Object

hashCode

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

Overrides:
hashCode in class java.lang.Object

compareKeys

public static int compareKeys(byte[] key1,
                              byte[] key2,
                              java.util.Comparator comparator)
Compare keys with an optional comparator.


dumpString

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

getNoFormatString

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



Copyright 2004,2008 Oracle. All rights reserved.