com.sleepycat.je.tree
Class Key

java.lang.Object
  extended bycom.sleepycat.je.tree.Key
All Implemented Interfaces:
Comparable, LogReadable, LogWritable

public final class Key
extends Object
implements Comparable, LogWritable, LogReadable

Key represents a JE B-Tree Key. Keys are immutable.


Field Summary
static boolean DUMP_BINARY
           
static boolean DUMP_INT_BINDING
           
 
Constructor Summary
Key()
          Construct a new key.
Key(byte[] key)
          Construct a new key from a byte array.
Key(DatabaseEntry dbt)
          Construct a new key from a DatabaseEntry.
 
Method Summary
static int compareByteArray(byte[] arg1, byte[] arg2)
           
 int compareTo(Object o)
          Compare two keys.
 byte[] copy()
           
 void dumpLog(StringBuffer sb, boolean verbose)
          Write the object into the string buffer for log dumping.
(package private)  String dumpString(int nspaces)
           
 boolean equals(Object o)
          Support Set of Key in BINReference.
 byte[] getKey()
          Get the byte array for the key.
 int getLogSize()
           
 String getNoFormatString()
          Print the string w/out XML format.
 long getTransactionId()
           
 int hashCode()
          Support HashSet of Key in BINReference.
 boolean logEntryIsTransactional()
           
 void readFromLog(ByteBuffer itemBuf)
          Initialize this object from the data in itemBuf.
 String toString()
           
 void writeToLog(ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DUMP_BINARY

public static boolean DUMP_BINARY

DUMP_INT_BINDING

public static boolean DUMP_INT_BINDING
Constructor Detail

Key

public Key()
Construct a new key.


Key

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


Key

public Key(DatabaseEntry dbt)
Construct a new key from a DatabaseEntry.

Method Detail

getKey

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


copy

public byte[] copy()

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.


hashCode

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


compareByteArray

public static int compareByteArray(byte[] arg1,
                                   byte[] arg2)

toString

public String toString()

getNoFormatString

public String getNoFormatString()
Print the string w/out XML format.


dumpString

String dumpString(int nspaces)

getLogSize

public int getLogSize()
Specified by:
getLogSize in interface LogWritable
Returns:
number of bytes used to store this object.
See Also:
LogWritable.getLogSize()

writeToLog

public void writeToLog(ByteBuffer logBuffer)
Description copied from interface: LogWritable
Serialize this object into the buffer.

Specified by:
writeToLog in interface LogWritable
Parameters:
logBuffer - is the destination buffer
See Also:
LogWritable.writeToLog(java.nio.ByteBuffer)

readFromLog

public void readFromLog(ByteBuffer itemBuf)
Description copied from interface: LogReadable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface LogReadable
See Also:
LogReadable.readFromLog(java.nio.ByteBuffer)

dumpLog

public void dumpLog(StringBuffer sb,
                    boolean verbose)
Description copied from interface: LogReadable
Write the object into the string buffer for log dumping. Each object should be dumped without indentation or new lines and should be valid XML.

Specified by:
dumpLog in interface LogReadable
Parameters:
sb - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
LogReadable.dumpLog(java.lang.StringBuffer, boolean)

logEntryIsTransactional

public boolean logEntryIsTransactional()
Specified by:
logEntryIsTransactional in interface LogReadable
Returns:
true if the LogEntry is a transactional log entry type.
See Also:
LogReadable.logEntryIsTransactional()

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface LogReadable
Returns:
return the transaction id if this log entry is transactional, 0 otherwise.
See Also:
LogReadable.getTransactionId()


Copyright 2004 Sleepycat, Inc. All Rights Reserved.