Introduced Record.getDataSize() method

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@709264 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-10-30 22:13:56 +00:00
parent 0fff7ab2d2
commit 3b262ac93e
13 changed files with 21 additions and 13 deletions

View File

@ -156,7 +156,7 @@ public final class BoundSheetRecord extends Record {
return buffer.toString();
}
private int getDataSize() {
protected int getDataSize() {
return 8 + field_5_sheetname.length() * (isMultibyte() ? 2 : 1);
}

View File

@ -130,7 +130,7 @@ public final class CFHeaderRecord extends Record {
return buffer.toString();
}
private int getDataSize() {
protected int getDataSize() {
return 4 // 2 short fields
+ CellRangeAddress.ENCODED_SIZE
+ field_4_cell_ranges.getSize();

View File

@ -63,7 +63,7 @@ public final class CRNRecord extends Record {
sb.append("]");
return sb.toString();
}
private int getDataSize() {
protected int getDataSize() {
return 4 + ConstantValueParser.getEncodedSize(field_4_constant_values);
}

View File

@ -153,8 +153,7 @@ public class ExternSheetRecord extends Record {
return sb.toString();
}
private int getDataSize() {
protected int getDataSize() {
return 2 + _list.size() * RefSubRecord.ENCODED_SIZE;
}

View File

@ -83,7 +83,7 @@ public final class ExternalNameRecord extends Record {
return field_4_name;
}
private int getDataSize(){
protected int getDataSize(){
int result = 3 * 2 // 3 short fields
+ 2 + field_4_name.length(); // nameLen and name
if(hasFormula()) {

View File

@ -353,7 +353,7 @@ public final class FormulaRecord extends Record implements CellValueRecordInterf
return sid;
}
private int getDataSize() {
protected int getDataSize() {
return FIXED_SIZE + field_8_parsed_expr.getEncodedSize();
}
public int serialize(int offset, byte [] data) {

View File

@ -119,7 +119,7 @@ public final class ObjRecord extends Record {
return sb.toString();
}
private int getDataSize() {
protected int getDataSize() {
if (_uninterpretedData != null) {
return _uninterpretedData.length;
}

View File

@ -97,7 +97,7 @@ public abstract class PageBreakRecord extends Record {
}
private int getDataSize() {
protected int getDataSize() {
return 2 + _breaks.size() * Break.ENCODED_SIZE;
}
public int getRecordSize() {

View File

@ -54,6 +54,15 @@ public abstract class Record extends RecordBase {
return retval;
}
/**
* @return the size of the data portion of this record
* (does not include initial 4 bytes for sid and size)
*/
protected int getDataSize() {
// implementation is currently a hack
// will eventually swap this out
return getRecordSize() - 4;
}
/**
* get a string representation of the record (for biffview/debugging)
*/

View File

@ -143,7 +143,7 @@ public final class SelectionRecord extends Record {
buffer.append("[/SELECTION]\n");
return buffer.toString();
}
private int getDataSize() {
protected int getDataSize() {
return 9 // 1 byte + 4 shorts
+ CellRangeAddress8Bit.getEncodedSize(field_6_refs.length);
}

View File

@ -158,7 +158,7 @@ public final class StyleRecord extends Record {
}
private int getDataSize() {
protected int getDataSize() {
if (isBuiltin()) {
return 4; // short, byte, byte
}

View File

@ -138,7 +138,7 @@ public final class SupBookRecord extends Record {
sb.append("]");
return sb.toString();
}
private int getDataSize() {
protected int getDataSize() {
if(!isExternalReferences()) {
return SMALL_RECORD_SIZE;
}

View File

@ -167,7 +167,7 @@ public final class TextObjectRecord extends Record {
* Only for the current record. does not include any subsequent Continue
* records
*/
private int getDataSize() {
protected int getDataSize() {
int result = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 4;
if (_linkRefPtg != null) {
result += 2 // formula size