public class SSTRecord extends Record
Description: This holds all the strings for LabelSSTRecords.
REFERENCE: PG 389 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)
LabelSSTRecord
,
ContinueRecord
Modifier and Type | Field and Description |
---|---|
(package private) int[] |
bucketAbsoluteOffsets
Offsets from the beginning of the SST record (even across continuations)
|
(package private) int[] |
bucketRelativeOffsets
Offsets relative the start of the current SST or continue record
|
private SSTDeserializer |
deserializer |
private static UnicodeString |
EMPTY_STRING |
private int |
field_1_num_strings
union of strings in the SST and EXTSST
|
private int |
field_2_num_unique_strings
according to docs ONLY SST
|
private IntMapper |
field_3_strings |
(package private) static int |
MAX_DATA_SPACE
how much data can we stuff into an SST record? That would be _max minus the standard SST record overhead
|
(package private) static int |
MAX_RECORD_SIZE
how big can an SST record be? As big as any record can be: 8228 bytes
|
static short |
sid |
(package private) static int |
SST_RECORD_OVERHEAD
SST overhead: the standard record overhead, plus the number of strings and the number of unique strings -- two ints
|
(package private) static int |
STD_RECORD_OVERHEAD
standard record overhead: two shorts (record id plus data space size)
|
(package private) static int |
STRING_MINIMAL_OVERHEAD
overhead for each string includes the string's character count (a short) and the flag describing its characteristics (a byte)
|
Constructor and Description |
---|
SSTRecord()
default constructor
|
SSTRecord(RecordInputStream in)
Constructs an SST record and sets its fields appropriately.
|
Modifier and Type | Method and 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.
|
(package private) int |
countStrings() |
ExtSSTRecord |
createExtSSTRecord(int sstOffset)
Creates an extended string record based on the current contents of
the current SST record.
|
boolean |
equals(Object o) |
protected void |
fillFields(RecordInputStream in)
Fill the fields from the data
|
(package private) SSTDeserializer |
getDeserializer() |
int |
getNumStrings() |
int |
getNumUniqueStrings() |
int |
getRecordSize()
gives the current serialized size of the record.
|
short |
getSid()
return the non static version of the id for this record.
|
UnicodeString |
getString(int id)
Get a particular string by its index
|
(package private) Iterator |
getStrings() |
int |
hashCode() |
boolean |
isString16bit(int id) |
int |
serialize(int offset,
byte[] data)
called by the class that is responsible for writing this sucker.
|
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 |
void |
setNumUniqueStrings(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 |
String |
toString()
Return a debugging string representation
|
protected void |
validateSid(short id)
validate SID
|
clone, isInValueSection, isValue, serialize
private static UnicodeString EMPTY_STRING
static final int MAX_RECORD_SIZE
static final int STD_RECORD_OVERHEAD
static final int SST_RECORD_OVERHEAD
static final int MAX_DATA_SPACE
static final int STRING_MINIMAL_OVERHEAD
public static final short sid
private int field_1_num_strings
private int field_2_num_unique_strings
private IntMapper field_3_strings
private SSTDeserializer deserializer
int[] bucketAbsoluteOffsets
int[] bucketRelativeOffsets
public SSTRecord()
public SSTRecord(RecordInputStream in)
in
- the RecordInputstream to read the record frompublic int addString(UnicodeString string)
string
- string to be addedpublic int getNumStrings()
public int getNumUniqueStrings()
public void setNumStrings(int count)
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 RECORDcount
- number of stringspublic void setNumUniqueStrings(int count)
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 RECORDcount
- number of stringspublic UnicodeString getString(int id)
id
- index into the array of stringspublic boolean isString16bit(int id)
public String toString()
public short getSid()
Record
protected void validateSid(short id) throws RecordFormatException
validateSid
in class Record
id
- the alleged SIDRecordFormatException
- if validation failsprotected void fillFields(RecordInputStream in)
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
fillFields
in class Record
in
- the RecordInputstream to read the record fromIterator getStrings()
int countStrings()
public int serialize(int offset, byte[] data)
public int getRecordSize()
Record
getRecordSize
in class Record
SSTDeserializer getDeserializer()
public ExtSSTRecord createExtSSTRecord(int sstOffset)
NOTE: THIS FUNCTION MUST ONLY BE CALLED AFTER THE SST RECORD HAS BEEN SERIALIZED.
sstOffset
- The offset in the stream to the start of the
SST record.public int calcExtSSTRecordSize()
Copyright © 2015 Open Microscopy Environment