FileDocCategorySizeDatePackage
LogRecordHeader.javaAPI DocGlassfish v2 API6221Fri May 04 22:36:38 BST 2007com.sun.jts.CosTransactions

LogRecordHeader

public class LogRecordHeader extends Object implements Serializable
A class containing header information for a log record.
version
0.01
author
Simon Holdsworth, IBM Corporation
see
LogHandle

Fields Summary
static final int
SIZEOF
This constant holds the size of the LogRecordHeader object.
int
recordType
LogLSN
currentLSN
LogLSN
previousLSN
LogLSN
nextLSN
int
recordLength
Constructors Summary
LogRecordHeader()


     
        currentLSN = new LogLSN();
        previousLSN = new LogLSN();
        nextLSN = new LogLSN();
    
LogRecordHeader(byte[] bytes, int index)
Constructs a LogRecordHeader from the given byte array.

param
bytes The array of bytes from which the object is to be constructed.
param
index The index in the array where copy is to start.
return
see

        recordType = (bytes[index++]&255) +
                     ((bytes[index++]&255) << 8) +
                     ((bytes[index++]&255) << 16) +
                     ((bytes[index++]&255) << 24);

        currentLSN  = new LogLSN(bytes,index);  index += LogLSN.SIZEOF;
        previousLSN = new LogLSN(bytes,index);  index += LogLSN.SIZEOF;
        nextLSN     = new LogLSN(bytes,index);  index += LogLSN.SIZEOF;

        recordLength = (bytes[index++]&255) +
                       ((bytes[index++]&255) << 8) +
                       ((bytes[index++]&255) << 16) +
                       ((bytes[index++]&255) << 24);
    
Methods Summary
voidcopy(com.sun.jts.CosTransactions.LogRecordHeader other)
Makes the target object a copy of the parameter.

param
other The object to be copied.
return
see

        recordType  = other.recordType;
        currentLSN.copy(other.currentLSN);
        previousLSN.copy(other.previousLSN);
        nextLSN.copy(other.nextLSN);
        recordLength = other.recordLength;
    
final inttoBytes(byte[] bytes, int index)
Makes a byte representation of the LogRecordHeader.

param
bytes The array of bytes into which the object is to be copied.
param
index The index in the array where copy is to start.
return
Number of bytes copied.
see

        bytes[index++] = (byte) recordType;
        bytes[index++] = (byte)(recordType >> 8);
        bytes[index++] = (byte)(recordType >> 16);
        bytes[index++] = (byte)(recordType >> 24);
        index += currentLSN.toBytes(bytes,index);
        index += previousLSN.toBytes(bytes,index);
        index += nextLSN.toBytes(bytes,index);
        bytes[index++] = (byte) recordLength;
        bytes[index++] = (byte)(recordLength >> 8);
        bytes[index++] = (byte)(recordLength >> 16);
        bytes[index++] = (byte)(recordLength >> 24);

        return SIZEOF;
    
public final java.lang.StringtoString()
This method is called to direct the object to format its state to a String.

param
return
The formatted representation of the object.
see

        return "LRH(type="/*#Frozen*/ + recordType + ",curr="/*#Frozen*/ + currentLSN +
               ",prev="/*#Frozen*/ + previousLSN + ",next="/*#Frozen*/ + nextLSN +
               ",len="/*#Frozen*/ + recordLength + ")"/*#Frozen*/;