com.sleepycat.je.cleaner
Class PackedOffsets

java.lang.Object
  extended by com.sleepycat.je.cleaner.PackedOffsets
All Implemented Interfaces:
LogReadable, LogWritable

public class PackedOffsets
extends Object
implements LogWritable, LogReadable

Stores a sorted list of LSN offsets in a packed short representation. Each stored value is the difference between two consecutive offsets. The stored values are stored as one or more shorts where each short holds 0x7fff values. Shorts are in LSB order. The value is negated if more shorts for the same offset follow; this works because offsets are always positive values.


Nested Class Summary
(package private)  class PackedOffsets.Iterator
          An iterator over all offsets.
 
Constructor Summary
PackedOffsets()
          Creates an empty object.
 
Method Summary
 void dumpLog(StringBuffer buf, boolean verbose)
          Write the object into the string buffer for log dumping.
 int getLogSize()
           
 long getTransactionId()
          Never called.
(package private)  PackedOffsets.Iterator iterator()
          Returns an iterator over all offsets.
 boolean logEntryIsTransactional()
          Never called.
 void pack(long[] offsets)
          Packs the given offsets, replacing any offsets stored in this object.
 void readFromLog(ByteBuffer buf, byte entryTypeVersion)
          Initialize this object from the data in itemBuf.
(package private)  long[] toArray()
          Returns the unpacked offsets.
 String toString()
           
 void writeToLog(ByteBuffer buf)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PackedOffsets

public PackedOffsets()
Creates an empty object.

Method Detail

iterator

PackedOffsets.Iterator iterator()
Returns an iterator over all offsets.


pack

public void pack(long[] offsets)
Packs the given offsets, replacing any offsets stored in this object.


toArray

long[] toArray()
Returns the unpacked offsets.


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 buf)
Description copied from interface: LogWritable
Serialize this object into the buffer.

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

readFromLog

public void readFromLog(ByteBuffer buf,
                        byte entryTypeVersion)
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, byte)

dumpLog

public void dumpLog(StringBuffer buf,
                    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:
buf - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
LogReadable.dumpLog(java.lang.StringBuffer, boolean)

getTransactionId

public long getTransactionId()
Never called.

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

logEntryIsTransactional

public boolean logEntryIsTransactional()
Never called.

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

toString

public String toString()
Overrides:
toString in class Object


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