com.sleepycat.je.log
Class FileHeader

java.lang.Object
  extended by com.sleepycat.je.log.FileHeader
All Implemented Interfaces:
Loggable

public class FileHeader
extends java.lang.Object
implements Loggable

A FileHeader embodies the header information at the beginning of each log file.


Constructor Summary
FileHeader()
          For logging only.
FileHeader(long fileNum, long lastEntryInPrevFileOffset)
           
 
Method Summary
 void dumpLog(java.lang.StringBuffer sb, boolean verbose)
          Write the object into the string buffer for log dumping.
static int entrySize()
          A header is always a known size.
(package private)  long getLastEntryInPrevFileOffset()
           
 int getLogSize()
           
 int getLogVersion()
           
 long getTransactionId()
           
 void readFromLog(java.nio.ByteBuffer logBuffer, byte entryTypeVersion)
          Initialize this object from the data in itemBuf.
 java.lang.String toString()
          Print in xml format
(package private)  boolean validate(java.lang.String fileName, long expectedFileNum)
           
 void writeToLog(java.nio.ByteBuffer logBuffer)
          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

FileHeader

FileHeader(long fileNum,
           long lastEntryInPrevFileOffset)

FileHeader

public FileHeader()
For logging only.

Method Detail

getLogVersion

public int getLogVersion()

validate

boolean validate(java.lang.String fileName,
                 long expectedFileNum)
           throws DatabaseException
Returns:
whether the file header has an old version number.
Throws:
DatabaseException - if the header isn't valid.

getLastEntryInPrevFileOffset

long getLastEntryInPrevFileOffset()
Returns:
the offset of the last entry in the previous file.

entrySize

public static int entrySize()
A header is always a known size. Is public for unit testing.


getLogSize

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

writeToLog

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

Specified by:
writeToLog in interface Loggable
Parameters:
logBuffer - is the destination buffer
See Also:
Serialize this object into the buffer. Update cksum with all the bytes used by this object

readFromLog

public void readFromLog(java.nio.ByteBuffer logBuffer,
                        byte entryTypeVersion)
                 throws LogException
Description copied from interface: Loggable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface Loggable
Parameters:
itemBuf - the source buffer
Throws:
LogException
See Also:
Initialize this object from the data in itemBuf.

dumpLog

public void dumpLog(java.lang.StringBuffer sb,
                    boolean verbose)
Description copied from interface: Loggable
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 Loggable
Parameters:
sb - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
Loggable.dumpLog(java.lang.StringBuffer, boolean)

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface Loggable
Returns:
the transaction id embedded within this loggable object. Objects that have no transaction id should return 0.
See Also:
Loggable.getTransactionId()

toString

public java.lang.String toString()
Print in xml format

Overrides:
toString in class java.lang.Object


Copyright 2004,2008 Oracle. All rights reserved.