Save This Page
Home » cocoon-2.1.11-src » org.apache.cocoon.poi » hssf » record » [javadoc | source]
org.apache.cocoon.poi.hssf.record
public class: SSTRecord [javadoc | source]
java.lang.Object
   org.apache.cocoon.poi.hssf.record.Record
      org.apache.cocoon.poi.hssf.record.SSTRecord
Title: Static String Table Record

Description: This holds all the strings for LabelSSTRecords.

Copyright: Copyright (c) 2001 SuperLink Software, Inc.

REFERENCE: PG 389 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)

Field Summary
public static final  short sid     
Fields inherited from org.apache.cocoon.poi.hssf.record.Record:
sid
Constructor:
 public SSTRecord() 
 public SSTRecord(short id,
    short size,
    byte[] data) 
 public SSTRecord(short id,
    short size,
    byte[] data,
    int offset) 
Method from org.apache.cocoon.poi.hssf.record.SSTRecord Summary:
addString,   addString,   constructBigStringArray,   countStrings,   equals,   fillFields,   getExpected,   getNumStrings,   getNumUniqueStrings,   getNumUniqueStrings,   getSid,   getString,   getStringDataOffset,   getStrings,   getTotalLength,   getUnfinishedString,   hashCode,   isWideChar,   processContinueRecord,   serialize,   setNumStrings,   toString,   validateSid
Methods from org.apache.cocoon.poi.hssf.record.Record:
fillFields,   fillFields,   getRecordSize,   getSid,   isInValueSection,   isValue,   processContinueRecord,   serialize,   toString,   validateSid
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.cocoon.poi.hssf.record.SSTRecord Detail:
 public int addString(String string) 
    Add a string. Determines whether 8-bit encoding can be used, or whether 16-bit encoding must be used.

    THIS IS THE PREFERRED METHOD OF ADDING A STRING. IF YOU USE THE OTHER ,code>addString METHOD AND FORCE 8-BIT ENCODING ON A STRING THAT SHOULD USE 16-BIT ENCODING, YOU WILL CORRUPT THE STRING; IF YOU USE THAT METHOD AND FORCE 16-BIT ENCODING, YOU ARE WASTING SPACE WHEN THE WORKBOOK IS WRITTEN OUT.

 public int addString(String string,
    boolean useUTF16) 
    Add a string and assert the encoding (8-bit or 16-bit) to be used.

    USE THIS METHOD AT YOUR OWN RISK. IF YOU FORCE 8-BIT ENCODING, YOU MAY CORRUPT YOUR STRING. IF YOU FORCE 16-BIT ENCODING AND IT ISN'T NECESSARY, YOU WILL WASTE SPACE WHEN THIS RECORD IS WRITTEN OUT.

 public byte[] constructBigStringArray() 
    Construct a byte array consisting of all of the strings in this record
 int countStrings() 
 public boolean equals(Object o) 
 protected  void fillFields(byte[] data,
    short size,
    int offset) 
    Fill the fields from the data

    The data consists of sets of string data. This string data is arranged as follows:

    short string_length; // length of string data byte string_flag; // flag specifying special string // handling short run_count; // optional count of formatting runs int extend_length; // optional extension length char[] string_data; // string data, can be byte[] or // short[] (length of array is // string_length) int[] formatting_runs; // optional formatting runs (length of // array is run_count) byte[] extension; // optional extension (length of array // is extend_length)

    The string_flag is bit mapped as follows:

    Bit number Meaning if 0 Meaning if 1
    0 string_data is byte[] string_data is short[]
    1 Should always be 0 string_flag is defective
    2 extension is not included extension is included
    3 formatting run data is not included formatting run data is included
    4 Should always be 0 string_flag is defective
    5 Should always be 0 string_flag is defective
    6 Should always be 0 string_flag is defective
    7 Should always be 0 string_flag is defective

    We can handle eating the overhead associated with bits 2 or 3 (or both) being set, but we have no idea what to do with the associated data. The UnicodeString class can handle the byte[] vs short[] nature of the actual string data

 int getExpected() 
 public int getNumStrings() 
 public int getNumUniqueStrings() 
 public  void getNumUniqueStrings(int count) 
    USE THIS METHOD AT YOUR OWN PERIL: THE addString METHODS MANIPULATE THE NUMBER OF UNIQUE STRINGS AS A SIDE EFFECT; YOUR ATTEMPTS AT MANIPULATING THE UNIQUE STRING COUNT IS LIKELY TO BE VERY WRONG AND WILL RESULT IN BAD BEHAVIOR WHEN THIS RECORD IS WRITTEN OUT AND ANOTHER PROCESS ATTEMPTS TO READ THE RECORD
 public short getSid() 
 public String getString(int id) 
    Get a particular string by its index
 int getStringDataOffset() 
 Iterator getStrings() 
 int getTotalLength() 
 String getUnfinishedString() 
 public int hashCode() 
 boolean isWideChar() 
 public  void processContinueRecord(byte[] record) 
    Process a Continue record. A Continue record for an SST record contains the same kind of data that the SST record contains, with the following exceptions:

    1. The string counts at the beginning of the SST record are not in the Continue record
    2. The first string in the Continue record might NOT begin with a size. If the last string in the previous record is continued in this record, the size is determined by that last string in the previous record; the first string will begin with a flag byte, followed by the remaining bytes (or words) of the last string from the previous record. Otherwise, the first string in the record will begin with a string length
 public byte[] serialize() 
    Create a byte array consisting of an SST record and any required Continue records, ready to be written out.

    If an SST record and any subsequent Continue records are read in to create this instance, this method should produce a byte array that is identical to the byte array produced by concatenating the input records' data.

 public  void setNumStrings(int count) 
    USE THIS METHOD AT YOUR OWN PERIL: THE addString METHODS MANIPULATE THE NUMBER OF STRINGS AS A SIDE EFFECT; YOUR ATTEMPTS AT MANIPULATING THE STRING COUNT IS LIKELY TO BE VERY WRONG AND WILL RESULT IN BAD BEHAVIOR WHEN THIS RECORD IS WRITTEN OUT AND ANOTHER PROCESS ATTEMPTS TO READ THE RECORD
 public String toString() 
    Return a debugging string representation
 protected  void validateSid(short id) throws RecordFormatException 
    validate SID