FileDocCategorySizeDatePackage
SSTRecordHeader.javaAPI DocApache Poi 3.0.12971Mon Jan 01 12:39:40 GMT 2007org.apache.poi.hssf.record

SSTRecordHeader

public class SSTRecordHeader extends Object
Write out an SST header record.
author
Glen Stampoultzis (glens at apache.org)

Fields Summary
int
numStrings
int
numUniqueStrings
Constructors Summary
public SSTRecordHeader(int numStrings, int numUniqueStrings)

        this.numStrings = numStrings;
        this.numUniqueStrings = numUniqueStrings;
    
Methods Summary
public intwriteSSTHeader(UnicodeString.UnicodeRecordStats stats, byte[] data, int bufferIndex, int recSize)
Writes out the SST record. This consists of the sid, the record size, the number of strings and the number of unique strings.

param
data The data buffer to write the header to.
param
bufferIndex The index into the data buffer where the header should be written.
param
recSize The number of records written.
return
The bufer of bytes modified.

        int offset = bufferIndex;

        LittleEndian.putShort( data, offset, SSTRecord.sid );
        offset += LittleEndianConsts.SHORT_SIZE;
        stats.recordSize += LittleEndianConsts.SHORT_SIZE;
        stats.remainingSize -= LittleEndianConsts.SHORT_SIZE;
        //Delay writing the length
        stats.lastLengthPos = offset;
        offset += LittleEndianConsts.SHORT_SIZE;
        stats.recordSize += LittleEndianConsts.SHORT_SIZE;
        stats.remainingSize -= LittleEndianConsts.SHORT_SIZE;
        LittleEndian.putInt( data, offset, numStrings );
        offset += LittleEndianConsts.INT_SIZE;
        stats.recordSize += LittleEndianConsts.INT_SIZE;
        stats.remainingSize -= LittleEndianConsts.INT_SIZE;
        LittleEndian.putInt( data, offset, numUniqueStrings );
        offset += LittleEndianConsts.INT_SIZE;
        stats.recordSize += LittleEndianConsts.INT_SIZE;
        stats.remainingSize -= LittleEndianConsts.INT_SIZE;

        return offset - bufferIndex;