Class SSTRecord
- java.lang.Object
-
- org.apache.poi.hssf.record.RecordBase
-
- org.apache.poi.hssf.record.Record
-
- org.apache.poi.hssf.record.cont.ContinuableRecord
-
- org.apache.poi.hssf.record.SSTRecord
-
- All Implemented Interfaces:
Duplicatable
,GenericRecord
public final class SSTRecord extends ContinuableRecord
Static String Table Record (0x00FC)This holds all the strings for LabelSSTRecords.
- See Also:
LabelSSTRecord
,ContinueRecord
-
-
Field Summary
Fields Modifier and Type Field Description static short
sid
-
Constructor Summary
Constructors Constructor Description SSTRecord()
SSTRecord(RecordInputStream in)
Fill the fields from the dataSSTRecord(SSTRecord other)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
addString(UnicodeString string)
Add a string.int
calcExtSSTRecordSize()
Calculates the size in bytes of the EXTSST record as it would be if the record was serialized.SSTRecord
copy()
ExtSSTRecord
createExtSSTRecord(int sstOffset)
Creates an extended string record based on the current contents of the current SST record.Map<String,Supplier<?>>
getGenericProperties()
HSSFRecordTypes
getGenericRecordType()
int
getNumStrings()
int
getNumUniqueStrings()
short
getSid()
return the non static version of the id for this record.UnicodeString
getString(int id)
Get a particular string by its indexprotected void
serialize(ContinuableRecordOutput out)
Serializes this record's content to the supplied data output.-
Methods inherited from class org.apache.poi.hssf.record.cont.ContinuableRecord
getRecordSize, serialize
-
Methods inherited from class org.apache.poi.hssf.record.Record
cloneViaReserialise, serialize, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericChildren
-
-
-
-
Field Detail
-
sid
public static final short sid
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SSTRecord
public SSTRecord()
-
SSTRecord
public SSTRecord(SSTRecord other)
-
SSTRecord
public SSTRecord(RecordInputStream in)
Fill the fields from the dataThe 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:
string_flag mapping 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
- Parameters:
in
- the RecordInputStream to read the record from
-
-
Method Detail
-
addString
public int addString(UnicodeString string)
Add a string.- Parameters:
string
- string to be added- Returns:
- the index of that string in the table
-
getNumStrings
public int getNumStrings()
- Returns:
- number of strings
-
getNumUniqueStrings
public int getNumUniqueStrings()
- Returns:
- number of unique strings
-
getString
public UnicodeString getString(int id)
Get a particular string by its index- Parameters:
id
- index into the array of strings- Returns:
- the desired string
-
getSid
public short getSid()
Description copied from class:Record
return the non static version of the id for this record.
-
serialize
protected void serialize(ContinuableRecordOutput out)
Description copied from class:ContinuableRecord
Serializes this record's content to the supplied data output.The standard BIFF header (ushort sid, ushort size) has been handled by the superclass, so only BIFF data should be written by this method. Simple data types can be written with the standard
LittleEndianOutput
methods. Methods fromContinuableRecordOutput
can be used to serialize strings (withContinueRecord
s being written as required). If necessary, implementors can explicitly startContinueRecord
s (regardless of the amount of remaining space).- Specified by:
serialize
in classContinuableRecord
- Parameters:
out
- a data output stream
-
createExtSSTRecord
public ExtSSTRecord createExtSSTRecord(int sstOffset)
Creates an extended string record based on the current contents of the current SST record. The offset within the stream to the SST record is required because the extended string record points directly to the strings in the SST record.NOTE: THIS FUNCTION MUST ONLY BE CALLED AFTER THE SST RECORD HAS BEEN SERIALIZED.
- Parameters:
sstOffset
- The offset in the stream to the start of the SST record.- Returns:
- The new SST record.
-
calcExtSSTRecordSize
public int calcExtSSTRecordSize()
Calculates the size in bytes of the EXTSST record as it would be if the record was serialized.- Returns:
- The size of the ExtSST record in bytes.
-
copy
public SSTRecord copy()
- Specified by:
copy
in interfaceDuplicatable
- Specified by:
copy
in classRecord
- Returns:
- a deep copy of the implementing class / instance
-
getGenericRecordType
public HSSFRecordTypes getGenericRecordType()
- Specified by:
getGenericRecordType
in interfaceGenericRecord
- Specified by:
getGenericRecordType
in classRecord
-
-