com.sleepycat.je.log
Class LogUtils

java.lang.Object
  extended bycom.sleepycat.je.log.LogUtils

public class LogUtils
extends Object

This class holds convenience methods for marshalling internal JE data to and from the log.


Field Summary
static int INT_BYTES
           
static int LONG_BYTES
           
static int UNSIGNED_INT_BYTES
           
 
Constructor Summary
LogUtils()
           
 
Method Summary
static boolean dumpBoolean(ByteBuffer itemBuffer, StringBuffer sb, String tag)
           
static int getBooleanLogSize()
           
static int getByteArrayLogSize(byte[] b)
           
static int getIntLogSize()
           
static int getLongLogSize()
           
static int getStringLogSize(String s)
           
static int getTimestampLogSize()
           
static long getUnsignedInt(ByteBuffer buf)
          Unmarshall the next four bytes which hold an unsigned int into a long.
static void putUnsignedInt(ByteBuffer buf, long value)
          Marshall a long into the next 4 bytes in this buffer.
static boolean readBoolean(ByteBuffer logBuf)
          Read a boolean from the log.
static byte[] readByteArray(ByteBuffer logBuf)
          Read a byte array from the log.
static int readInt(ByteBuffer logBuf)
          Read a int from the log.
static long readLong(ByteBuffer logBuf)
          Read a long from the log.
static String readString(ByteBuffer logBuf)
          Read a string from the log.
static Timestamp readTimestamp(ByteBuffer logBuf)
          Read a timestamp from the log.
static void writeBoolean(ByteBuffer logBuf, boolean bool)
          Write a boolean into the log.
static void writeByteArray(ByteBuffer logBuf, byte[] b)
          Write a byte array into the log.
static void writeInt(ByteBuffer logBuf, int i)
          Write an int into the log.
static void writeLong(ByteBuffer logBuf, long l)
          Write a long into the log.
static void writeString(ByteBuffer logBuf, String stringVal)
          Write a string into the log.
static void writeTimestamp(ByteBuffer logBuf, Timestamp time)
          Write a timestamp into the log.
static void writeUnsignedInt(ByteBuffer logBuf, long value)
          Write a long as an unsigned int.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INT_BYTES

public static final int INT_BYTES
See Also:
Constant Field Values

LONG_BYTES

public static final int LONG_BYTES
See Also:
Constant Field Values

UNSIGNED_INT_BYTES

public static final int UNSIGNED_INT_BYTES
See Also:
Constant Field Values
Constructor Detail

LogUtils

public LogUtils()
Method Detail

putUnsignedInt

public static void putUnsignedInt(ByteBuffer buf,
                                  long value)
Marshall a long into the next 4 bytes in this buffer. Necessary when the long is used to hold an unsigned int.


writeUnsignedInt

public static void writeUnsignedInt(ByteBuffer logBuf,
                                    long value)
Write a long as an unsigned int.


getUnsignedInt

public static long getUnsignedInt(ByteBuffer buf)
Unmarshall the next four bytes which hold an unsigned int into a long.


writeInt

public static void writeInt(ByteBuffer logBuf,
                            int i)
Write an int into the log.


readInt

public static int readInt(ByteBuffer logBuf)
Read a int from the log.


getIntLogSize

public static int getIntLogSize()
Returns:
log storage size for a byteArray.

writeLong

public static void writeLong(ByteBuffer logBuf,
                             long l)
Write a long into the log.


readLong

public static long readLong(ByteBuffer logBuf)
Read a long from the log.


getLongLogSize

public static int getLongLogSize()
Returns:
log storage size for a byteArray.

writeByteArray

public static void writeByteArray(ByteBuffer logBuf,
                                  byte[] b)
Write a byte array into the log. The size is stored first as an integer.


readByteArray

public static byte[] readByteArray(ByteBuffer logBuf)
Read a byte array from the log. The size is stored first as an integer.


getByteArrayLogSize

public static int getByteArrayLogSize(byte[] b)
Returns:
log storage size for a byteArray

writeString

public static void writeString(ByteBuffer logBuf,
                               String stringVal)
Write a string into the log. The size is stored first as an integer.


readString

public static String readString(ByteBuffer logBuf)
Read a string from the log. The size is stored first as an integer.


getStringLogSize

public static int getStringLogSize(String s)
Returns:
log storage size for a string

writeTimestamp

public static void writeTimestamp(ByteBuffer logBuf,
                                  Timestamp time)
Write a timestamp into the log.


readTimestamp

public static Timestamp readTimestamp(ByteBuffer logBuf)
Read a timestamp from the log.


getTimestampLogSize

public static int getTimestampLogSize()
Returns:
log storage size for a timestamp

writeBoolean

public static void writeBoolean(ByteBuffer logBuf,
                                boolean bool)
Write a boolean into the log.


readBoolean

public static boolean readBoolean(ByteBuffer logBuf)
Read a boolean from the log.


getBooleanLogSize

public static int getBooleanLogSize()
Returns:
log storage size for a boolean.

dumpBoolean

public static boolean dumpBoolean(ByteBuffer itemBuffer,
                                  StringBuffer sb,
                                  String tag)


Copyright 2004 Sleepycat, Inc. All Rights Reserved.