From: Josh Micich Date: Tue, 30 Sep 2008 06:18:44 +0000 (+0000) Subject: Refactored fillFields() method into constructor in Record class hierarchy X-Git-Tag: REL_3_2_FINAL~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=15e0710fecd53a6e271d7118213df95be135e7e8;p=poi.git Refactored fillFields() method into constructor in Record class hierarchy git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@700356 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/LastCellOfRowDummyRecord.java b/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/LastCellOfRowDummyRecord.java index b259788a85..670fa99d2a 100644 --- a/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/LastCellOfRowDummyRecord.java +++ b/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/LastCellOfRowDummyRecord.java @@ -18,7 +18,6 @@ package org.apache.poi.hssf.eventusermodel.dummyrecord; import org.apache.poi.hssf.record.Record; -import org.apache.poi.hssf.record.RecordInputStream; /** * A dummy record to indicate that we've now had the last @@ -47,15 +46,10 @@ public class LastCellOfRowDummyRecord extends Record { */ public int getLastColumnNumber() { return lastColumnNumber; } - protected void fillFields(RecordInputStream in) { - } public short getSid() { return -1; } public int serialize(int offset, byte[] data) { return -1; } - protected void validateSid(short id) { - } - } diff --git a/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/MissingCellDummyRecord.java b/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/MissingCellDummyRecord.java index 61dc7ac5bd..587ccb6596 100644 --- a/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/MissingCellDummyRecord.java +++ b/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/MissingCellDummyRecord.java @@ -18,7 +18,6 @@ package org.apache.poi.hssf.eventusermodel.dummyrecord; import org.apache.poi.hssf.record.Record; -import org.apache.poi.hssf.record.RecordInputStream; /** * A dummy record for when we're missing a cell in a row, @@ -33,16 +32,12 @@ public class MissingCellDummyRecord extends Record { this.column = column; } - protected void fillFields(RecordInputStream in) { - } public short getSid() { return -1; } public int serialize(int offset, byte[] data) { return -1; } - protected void validateSid(short id) { - } public int getRow() { return row; } public int getColumn() { return column; } diff --git a/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/MissingRowDummyRecord.java b/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/MissingRowDummyRecord.java index 68a86528ac..46f76b1d34 100644 --- a/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/MissingRowDummyRecord.java +++ b/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/MissingRowDummyRecord.java @@ -31,16 +31,12 @@ public class MissingRowDummyRecord extends Record { this.rowNumber = rowNumber; } - protected void fillFields(RecordInputStream in) { - } public short getSid() { return -1; } public int serialize(int offset, byte[] data) { return -1; } - protected void validateSid(short id) { - } public int getRowNumber() { return rowNumber; diff --git a/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java b/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java index 89eb9301b7..295a86a703 100644 --- a/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java +++ b/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java @@ -57,18 +57,7 @@ public abstract class AbstractEscherHolderRecord escherRecords = new ArrayList(); } - /** - * Constructs a Bar record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ public AbstractEscherHolderRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { escherRecords = new ArrayList(); if (! DESERIALISE ) diff --git a/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java b/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java index de810245a5..65658ab3ed 100644 --- a/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java @@ -48,19 +48,7 @@ public final class AreaFormatRecord extends Record { } - /** - * Constructs a AreaFormat record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public AreaFormatRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_foregroundColor = in.readInt(); field_2_backgroundColor = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/AreaRecord.java b/src/java/org/apache/poi/hssf/record/AreaRecord.java index 17d54ce8bb..de994427f5 100644 --- a/src/java/org/apache/poi/hssf/record/AreaRecord.java +++ b/src/java/org/apache/poi/hssf/record/AreaRecord.java @@ -42,19 +42,7 @@ public final class AreaRecord extends Record { } - /** - * Constructs a Area record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public AreaRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_formatFlags = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java b/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java index 9aa8407fc5..64d2a071d9 100644 --- a/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java @@ -46,19 +46,7 @@ public class AxisLineFormatRecord } - /** - * Constructs a AxisLineFormat record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public AxisLineFormatRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_axisType = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java b/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java index 20ab70bcb8..54cd2b49bc 100644 --- a/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java +++ b/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java @@ -57,19 +57,7 @@ public final class AxisOptionsRecord extends Record { } - /** - * Constructs a AxisOptions record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public AxisOptionsRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_minimumCategory = in.readShort(); field_2_maximumCategory = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/AxisParentRecord.java b/src/java/org/apache/poi/hssf/record/AxisParentRecord.java index 150acb2b2e..281a0824f5 100644 --- a/src/java/org/apache/poi/hssf/record/AxisParentRecord.java +++ b/src/java/org/apache/poi/hssf/record/AxisParentRecord.java @@ -48,19 +48,7 @@ public class AxisParentRecord } - /** - * Constructs a AxisParent record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public AxisParentRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_axisType = in.readShort(); field_2_x = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/AxisRecord.java b/src/java/org/apache/poi/hssf/record/AxisRecord.java index 3f95651247..b57ac1d4f9 100644 --- a/src/java/org/apache/poi/hssf/record/AxisRecord.java +++ b/src/java/org/apache/poi/hssf/record/AxisRecord.java @@ -49,19 +49,7 @@ public class AxisRecord } - /** - * Constructs a Axis record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public AxisRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_axisType = in.readShort(); field_2_reserved1 = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java b/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java index bde01c32a8..361ae2304f 100644 --- a/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java +++ b/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java @@ -42,19 +42,7 @@ public class AxisUsedRecord } - /** - * Constructs a AxisUsed record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public AxisUsedRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_numAxis = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/BOFRecord.java b/src/java/org/apache/poi/hssf/record/BOFRecord.java index a7c3ee0ef3..672505f5b0 100644 --- a/src/java/org/apache/poi/hssf/record/BOFRecord.java +++ b/src/java/org/apache/poi/hssf/record/BOFRecord.java @@ -86,19 +86,7 @@ public class BOFRecord { } - /** - * Constructs a BOFRecord and sets its fields appropriately - * @param in the RecordInputstream to read the record from - */ - public BOFRecord(RecordInputStream in) - { - super(in); - - // fillFields(data,size); - } - - protected void fillFields(RecordInputStream in) { field_1_version = in.readShort(); field_2_type = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/BackupRecord.java b/src/java/org/apache/poi/hssf/record/BackupRecord.java index 47370f4fb2..2ffbb5ba79 100644 --- a/src/java/org/apache/poi/hssf/record/BackupRecord.java +++ b/src/java/org/apache/poi/hssf/record/BackupRecord.java @@ -40,17 +40,7 @@ public class BackupRecord { } - /** - * Constructs a BackupRecord and sets its fields appropriately - * @param in the RecordInputstream to read the record from - */ - public BackupRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_backup = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/BarRecord.java b/src/java/org/apache/poi/hssf/record/BarRecord.java index 2239e56e01..dbf41202ac 100644 --- a/src/java/org/apache/poi/hssf/record/BarRecord.java +++ b/src/java/org/apache/poi/hssf/record/BarRecord.java @@ -47,19 +47,7 @@ public final class BarRecord extends Record { } - /** - * Constructs a Bar record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public BarRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_barSpace = in.readShort(); field_2_categorySpace = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/BeginRecord.java b/src/java/org/apache/poi/hssf/record/BeginRecord.java index f7347619c8..c983590bd6 100644 --- a/src/java/org/apache/poi/hssf/record/BeginRecord.java +++ b/src/java/org/apache/poi/hssf/record/BeginRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; @@ -29,10 +27,7 @@ import org.apache.poi.util.LittleEndian; * * @author Glen Stampoultzis (glens at apache.org) */ - -public class BeginRecord - extends Record -{ +public class BeginRecord extends Record { public static final short sid = 0x1033; public BeginRecord() @@ -40,16 +35,9 @@ public class BeginRecord } /** - * Constructs a BeginRecord record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from + * @param in unused (since this record has no data) */ - public BeginRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { } @@ -64,9 +52,8 @@ public class BeginRecord public int serialize(int offset, byte [] data) { - LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, - (( short ) 0)); // no record info + LittleEndian.putUShort(data, 0 + offset, sid); + LittleEndian.putUShort(data, 2 + offset, 0); // no record info return getRecordSize(); } diff --git a/src/java/org/apache/poi/hssf/record/BlankRecord.java b/src/java/org/apache/poi/hssf/record/BlankRecord.java index 4d333eb418..864cc53c3c 100644 --- a/src/java/org/apache/poi/hssf/record/BlankRecord.java +++ b/src/java/org/apache/poi/hssf/record/BlankRecord.java @@ -39,16 +39,7 @@ public final class BlankRecord extends Record implements CellValueRecordInterfac { } - /** - * Constructs a BlankRecord and sets its fields appropriately - * @param in the RecordInputstream to read the record from - */ public BlankRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_row = in.readUShort(); field_2_col = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/BookBoolRecord.java b/src/java/org/apache/poi/hssf/record/BookBoolRecord.java index 150dc5dfda..0ad7a5ac60 100644 --- a/src/java/org/apache/poi/hssf/record/BookBoolRecord.java +++ b/src/java/org/apache/poi/hssf/record/BookBoolRecord.java @@ -40,17 +40,7 @@ public class BookBoolRecord { } - /** - * Constructs a BookBoolRecord and sets its fields appropriately - * @param in the RecordInputstream to read the record from - */ - public BookBoolRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_save_link_values = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/BoolErrRecord.java b/src/java/org/apache/poi/hssf/record/BoolErrRecord.java index 77ece1632c..bed162f94c 100644 --- a/src/java/org/apache/poi/hssf/record/BoolErrRecord.java +++ b/src/java/org/apache/poi/hssf/record/BoolErrRecord.java @@ -41,19 +41,9 @@ public final class BoolErrRecord extends Record implements CellValueRecordInterf } /** - * Constructs a BoolErr record and sets its fields appropriately. - * * @param in the RecordInputstream to read the record from */ public BoolErrRecord(RecordInputStream in) - { - super(in); - } - - /** - * @param in the RecordInputstream to read the record from - */ - protected void fillFields(RecordInputStream in) { //field_1_row = LittleEndian.getShort(data, 0 + offset); field_1_row = in.readUShort(); diff --git a/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java b/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java index 8c8a4a9434..c8f50ff1c1 100644 --- a/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java @@ -39,17 +39,7 @@ public class BottomMarginRecord } - /** - * Constructs a BottomMargin record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ public BottomMarginRecord( RecordInputStream in ) - { - super( in ); - } - - protected void fillFields( RecordInputStream in ) { field_1_margin = in.readDouble(); } @@ -108,4 +98,4 @@ public class BottomMarginRecord return rec; } -} // END OF CLASS \ No newline at end of file +} // END OF CLAS \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java b/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java index 5cc087e656..036de6b2df 100644 --- a/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java +++ b/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java @@ -52,15 +52,6 @@ public final class BoundSheetRecord extends Record { setSheetname(sheetname); } - /** - * Constructs a BoundSheetRecord and sets its fields appropriately - * - * @param in the RecordInputstream to read the record from - */ - public BoundSheetRecord(RecordInputStream in) { - super(in); - } - /** * UTF8: sid + len + bof + flags + len(str) + unicode + str 2 + 2 + 4 + 2 + * 1 + 1 + len(str) @@ -69,7 +60,7 @@ public final class BoundSheetRecord extends Record { * 1 + 1 + 2 * len(str) * */ - protected void fillFields(RecordInputStream in) { + public BoundSheetRecord(RecordInputStream in) { field_1_position_of_BOF = in.readInt(); field_2_option_flags = in.readUShort(); int field_3_sheetname_length = in.readUByte(); diff --git a/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java b/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java index af8e4315ee..47fba0b955 100644 --- a/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java +++ b/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java @@ -48,11 +48,6 @@ public final class CFHeaderRecord extends Record { } public CFHeaderRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_numcf = in.readShort(); field_2_need_recalculation = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/CFRuleRecord.java b/src/java/org/apache/poi/hssf/record/CFRuleRecord.java index c440b416fb..ef8e05c29d 100644 --- a/src/java/org/apache/poi/hssf/record/CFRuleRecord.java +++ b/src/java/org/apache/poi/hssf/record/CFRuleRecord.java @@ -159,10 +159,6 @@ public final class CFRuleRecord extends Record { } public CFRuleRecord(RecordInputStream in) { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_condition_type = in.readByte(); field_2_comparison_operator = in.readByte(); int field_3_formula1_len = in.readUShort(); diff --git a/src/java/org/apache/poi/hssf/record/CRNCountRecord.java b/src/java/org/apache/poi/hssf/record/CRNCountRecord.java index 288031d5b8..5df98bf34e 100755 --- a/src/java/org/apache/poi/hssf/record/CRNCountRecord.java +++ b/src/java/org/apache/poi/hssf/record/CRNCountRecord.java @@ -38,16 +38,12 @@ public final class CRNCountRecord extends Record { throw new RuntimeException("incomplete code"); } - public CRNCountRecord(RecordInputStream in) { - super(in); - } - public int getNumberOfCRNs() { return field_1_number_crn_records; } - protected void fillFields(RecordInputStream in) { + public CRNCountRecord(RecordInputStream in) { field_1_number_crn_records = in.readShort(); if(field_1_number_crn_records < 0) { // TODO - seems like the sign bit of this field might be used for some other purpose diff --git a/src/java/org/apache/poi/hssf/record/CRNRecord.java b/src/java/org/apache/poi/hssf/record/CRNRecord.java index 98c399a21b..417f2a559a 100755 --- a/src/java/org/apache/poi/hssf/record/CRNRecord.java +++ b/src/java/org/apache/poi/hssf/record/CRNRecord.java @@ -39,16 +39,12 @@ public final class CRNRecord extends Record { throw new RuntimeException("incomplete code"); } - public CRNRecord(RecordInputStream in) { - super(in); - } - public int getNumberOfCRNs() { return field_1_last_column_index; } - protected void fillFields(RecordInputStream in) { + public CRNRecord(RecordInputStream in) { field_1_last_column_index = in.readByte() & 0x00FF; field_2_first_column_index = in.readByte() & 0x00FF; field_3_row_index = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/CalcCountRecord.java b/src/java/org/apache/poi/hssf/record/CalcCountRecord.java index 0d4d5e0d7d..eb783f3857 100644 --- a/src/java/org/apache/poi/hssf/record/CalcCountRecord.java +++ b/src/java/org/apache/poi/hssf/record/CalcCountRecord.java @@ -45,18 +45,7 @@ public class CalcCountRecord { } - /** - * Constructs a CalcCountRecord and sets its fields appropriately - * @param in the RecordInputstream to read the record from - * - */ - public CalcCountRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_iterations = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/CalcModeRecord.java b/src/java/org/apache/poi/hssf/record/CalcModeRecord.java index b2c323de45..de8d860fce 100644 --- a/src/java/org/apache/poi/hssf/record/CalcModeRecord.java +++ b/src/java/org/apache/poi/hssf/record/CalcModeRecord.java @@ -61,17 +61,7 @@ public class CalcModeRecord { } - /** - * Constructs a CalcModeRecord and sets its fields appropriately - * @param in the RecordInputstream to read the record from - */ - public CalcModeRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_calcmode = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java b/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java index ff59063604..158b3e5cf6 100644 --- a/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java +++ b/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java @@ -47,19 +47,7 @@ public final class CategorySeriesAxisRecord extends Record { } - /** - * Constructs a CategorySeriesAxis record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public CategorySeriesAxisRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_crossingPoint = in.readShort(); field_2_labelFrequency = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java b/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java index f7c6384df9..490cdd4555 100644 --- a/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java @@ -44,17 +44,7 @@ public final class ChartFormatRecord extends Record { { } - /** - * Constructs a ChartFormatRecord record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public ChartFormatRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field1_x_position = in.readInt(); field2_y_position = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/ChartRecord.java b/src/java/org/apache/poi/hssf/record/ChartRecord.java index 6e2e98191b..9ce93946ae 100644 --- a/src/java/org/apache/poi/hssf/record/ChartRecord.java +++ b/src/java/org/apache/poi/hssf/record/ChartRecord.java @@ -45,19 +45,7 @@ public class ChartRecord } - /** - * Constructs a Chart record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public ChartRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_x = in.readInt(); field_2_y = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java b/src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java index 0d522e7775..fd22d5229b 100644 --- a/src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java @@ -59,10 +59,6 @@ public class ChartTitleFormatRecord extends Record { } public ChartTitleFormatRecord(RecordInputStream in) { - super(in); - } - - protected void fillFields(RecordInputStream in) { m_recs = in.readUShort(); int idx; CTFormat ctf; diff --git a/src/java/org/apache/poi/hssf/record/CodepageRecord.java b/src/java/org/apache/poi/hssf/record/CodepageRecord.java index 285f5d0b57..4675fe4730 100644 --- a/src/java/org/apache/poi/hssf/record/CodepageRecord.java +++ b/src/java/org/apache/poi/hssf/record/CodepageRecord.java @@ -47,17 +47,7 @@ public class CodepageRecord { } - /** - * Constructs a CodepageRecord and sets its fields appropriately - * @param in the RecordInputstream to read the record from - */ - public CodepageRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_codepage = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java b/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java index b8934efb08..38d05181c9 100644 --- a/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java +++ b/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java @@ -52,17 +52,7 @@ public final class ColumnInfoRecord extends Record { field_6_reserved = 2; // seems to be the most common value } - /** - * Constructs a ColumnInfo record and sets its fields appropriately - * @param in the RecordInputstream to read the record from - */ - public ColumnInfoRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_first_col = in.readUShort(); field_2_last_col = in.readUShort(); diff --git a/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java b/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java index 43c6ad8549..ed2372d82f 100644 --- a/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java @@ -82,18 +82,7 @@ public final class CommonObjectDataSubRecord extends SubRecord { } - /** - * Constructs a CommonObjectData record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public CommonObjectDataSubRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_objectType = in.readShort(); field_2_objectId = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/ContinueRecord.java b/src/java/org/apache/poi/hssf/record/ContinueRecord.java index 5402a46bd3..435c454712 100644 --- a/src/java/org/apache/poi/hssf/record/ContinueRecord.java +++ b/src/java/org/apache/poi/hssf/record/ContinueRecord.java @@ -45,17 +45,6 @@ public class ContinueRecord { } - /** - * Main constructor -- kinda dummy because we don't validate or fill fields - * - * @param in the RecordInputstream to read the record from - */ - - public ContinueRecord(RecordInputStream in) - { - super(in); - } - /** * USE ONLY within "processContinue" */ @@ -125,7 +114,7 @@ public class ContinueRecord * @param in the RecordInputstream to read the record from */ - protected void fillFields(RecordInputStream in) + public ContinueRecord(RecordInputStream in) { field_1_data = in.readRemainder(); } diff --git a/src/java/org/apache/poi/hssf/record/CountryRecord.java b/src/java/org/apache/poi/hssf/record/CountryRecord.java index 0acccfd918..7d739a9b65 100644 --- a/src/java/org/apache/poi/hssf/record/CountryRecord.java +++ b/src/java/org/apache/poi/hssf/record/CountryRecord.java @@ -44,17 +44,7 @@ public class CountryRecord { } - /** - * Constructs a CountryRecord and sets its fields appropriately - * @param in the RecordInputstream to read the record from - */ - public CountryRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_default_country = in.readShort(); field_2_current_country = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/DBCellRecord.java b/src/java/org/apache/poi/hssf/record/DBCellRecord.java index efa713aec6..4085027dd4 100644 --- a/src/java/org/apache/poi/hssf/record/DBCellRecord.java +++ b/src/java/org/apache/poi/hssf/record/DBCellRecord.java @@ -38,16 +38,7 @@ public final class DBCellRecord extends Record { field_2_cell_offsets = new short[0]; } - /** - * Constructs a DBCellRecord and sets its fields appropriately - * @param in the RecordInputstream to read the record from - */ public DBCellRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_row_offset = in.readUShort(); int size = in.remaining(); diff --git a/src/java/org/apache/poi/hssf/record/DSFRecord.java b/src/java/org/apache/poi/hssf/record/DSFRecord.java index 43dbe79580..9d405b3dda 100644 --- a/src/java/org/apache/poi/hssf/record/DSFRecord.java +++ b/src/java/org/apache/poi/hssf/record/DSFRecord.java @@ -40,17 +40,7 @@ public class DSFRecord { } - /** - * Constructs a DBCellRecord and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public DSFRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_dsf = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/DVALRecord.java b/src/java/org/apache/poi/hssf/record/DVALRecord.java index c4fac186d2..9235ef2c6c 100644 --- a/src/java/org/apache/poi/hssf/record/DVALRecord.java +++ b/src/java/org/apache/poi/hssf/record/DVALRecord.java @@ -48,18 +48,7 @@ public class DVALRecord extends Record field_5_dv_no = 0x00000000; } - /** - * Constructs a DVAL record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - - public DVALRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) + public DVALRecord(RecordInputStream in) { this.field_1_options = in.readShort(); this.field_2_horiz_pos = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/DVRecord.java b/src/java/org/apache/poi/hssf/record/DVRecord.java index 2a3dc05f14..0c0cd1b73f 100644 --- a/src/java/org/apache/poi/hssf/record/DVRecord.java +++ b/src/java/org/apache/poi/hssf/record/DVRecord.java @@ -75,15 +75,6 @@ public final class DVRecord extends Record { private static final BitField opt_show_error_on_invalid_value = new BitField(0x00080000); private static final BitField opt_condition_operator = new BitField(0x00700000); - /** - * Constructs a DV record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public DVRecord(RecordInputStream in) { - super(in); - } - public DVRecord(int validationType, int operator, int errorStyle, boolean emptyCellAllowed, boolean suppressDropDownArrow, boolean isExplicitList, boolean showPromptBox, String promptTitle, String promptText, @@ -110,7 +101,7 @@ public final class DVRecord extends Record { _regions = regions; } - protected void fillFields(RecordInputStream in) { + public DVRecord(RecordInputStream in) { _option_flags = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/DatRecord.java b/src/java/org/apache/poi/hssf/record/DatRecord.java index c7ece181ae..a6c5040150 100644 --- a/src/java/org/apache/poi/hssf/record/DatRecord.java +++ b/src/java/org/apache/poi/hssf/record/DatRecord.java @@ -45,19 +45,7 @@ public final class DatRecord extends Record { } - /** - * Constructs a Dat record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public DatRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_options = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/DataFormatRecord.java b/src/java/org/apache/poi/hssf/record/DataFormatRecord.java index 61c59bcfd3..7d37704eb7 100644 --- a/src/java/org/apache/poi/hssf/record/DataFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/DataFormatRecord.java @@ -45,19 +45,7 @@ public final class DataFormatRecord extends Record { } - /** - * Constructs a DataFormat record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public DataFormatRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_pointNumber = in.readShort(); field_2_seriesIndex = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/DateWindow1904Record.java b/src/java/org/apache/poi/hssf/record/DateWindow1904Record.java index 5e7ffe95bf..dd023fa803 100644 --- a/src/java/org/apache/poi/hssf/record/DateWindow1904Record.java +++ b/src/java/org/apache/poi/hssf/record/DateWindow1904Record.java @@ -40,17 +40,7 @@ public class DateWindow1904Record { } - /** - * Constructs a DateWindow1904 record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public DateWindow1904Record(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_window = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java b/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java index 9d3e5d80e6..8ceb88edfa 100644 --- a/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java +++ b/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java @@ -36,17 +36,7 @@ public final class DefaultColWidthRecord extends Record { { } - /** - * Constructs a DefaultColumnWidth record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public DefaultColWidthRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_col_width = in.readUShort(); } diff --git a/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java b/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java index 58b3b8f5cf..49120e75a7 100644 --- a/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java +++ b/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java @@ -45,19 +45,7 @@ public class DefaultDataLabelTextPropertiesRecord } - /** - * Constructs a DefaultDataLabelTextProperties record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public DefaultDataLabelTextPropertiesRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_categoryDataType = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java b/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java index bb93ff83de..ae48ea4b00 100644 --- a/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java +++ b/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java @@ -42,17 +42,7 @@ public class DefaultRowHeightRecord { } - /** - * Constructs a DefaultRowHeight record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public DefaultRowHeightRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_option_flags = in.readShort(); field_2_row_height = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/DeltaRecord.java b/src/java/org/apache/poi/hssf/record/DeltaRecord.java index 467431eadd..d02eb2cef7 100644 --- a/src/java/org/apache/poi/hssf/record/DeltaRecord.java +++ b/src/java/org/apache/poi/hssf/record/DeltaRecord.java @@ -44,17 +44,7 @@ public class DeltaRecord { } - /** - * Constructs a Delta record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public DeltaRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_max_change = in.readDouble(); } diff --git a/src/java/org/apache/poi/hssf/record/DimensionsRecord.java b/src/java/org/apache/poi/hssf/record/DimensionsRecord.java index adf9f7edf2..fa7477bc79 100644 --- a/src/java/org/apache/poi/hssf/record/DimensionsRecord.java +++ b/src/java/org/apache/poi/hssf/record/DimensionsRecord.java @@ -45,17 +45,7 @@ public class DimensionsRecord { } - /** - * Constructs a Dimensions record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public DimensionsRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_first_row = in.readInt(); field_2_last_row = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/DrawingRecord.java b/src/java/org/apache/poi/hssf/record/DrawingRecord.java index 089c15f903..c8c54123c9 100644 --- a/src/java/org/apache/poi/hssf/record/DrawingRecord.java +++ b/src/java/org/apache/poi/hssf/record/DrawingRecord.java @@ -30,11 +30,6 @@ public class DrawingRecord extends Record } public DrawingRecord( RecordInputStream in ) - { - super( in ); - } - - protected void fillFields( RecordInputStream in ) { recordData = in.readRemainder(); } diff --git a/src/java/org/apache/poi/hssf/record/EOFRecord.java b/src/java/org/apache/poi/hssf/record/EOFRecord.java index 96159b42ab..f7495179b4 100644 --- a/src/java/org/apache/poi/hssf/record/EOFRecord.java +++ b/src/java/org/apache/poi/hssf/record/EOFRecord.java @@ -40,16 +40,9 @@ public final class EOFRecord extends Record { } /** - * Constructs a EOFRecord record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from + * @param in unused (since this record has no data) */ - public EOFRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { } diff --git a/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java b/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java index b33519c8e1..fb6bce5d3a 100644 --- a/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java @@ -54,22 +54,12 @@ public class EmbeddedObjectRefSubRecord field_5_ole_classname = ""; } - /** - * Constructs an EmbeddedObjectRef record and sets its fields appropriately. - * - * @param in the record input stream. - */ - public EmbeddedObjectRefSubRecord(RecordInputStream in) - { - super(in); - } - public short getSid() { return sid; } - protected void fillFields(RecordInputStream in) + public EmbeddedObjectRefSubRecord(RecordInputStream in) { field_1_stream_id_offset = in.readShort(); field_2_unknown = in.readShortArray(); diff --git a/src/java/org/apache/poi/hssf/record/EndRecord.java b/src/java/org/apache/poi/hssf/record/EndRecord.java index 48e50ac128..6f91dc3a24 100644 --- a/src/java/org/apache/poi/hssf/record/EndRecord.java +++ b/src/java/org/apache/poi/hssf/record/EndRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; @@ -30,9 +28,7 @@ import org.apache.poi.util.LittleEndian; * @author Glen Stampoultzis (glens at apache.org) */ -public class EndRecord - extends Record -{ +public final class EndRecord extends Record { public static final short sid = 0x1034; public EndRecord() @@ -40,16 +36,9 @@ public class EndRecord } /** - * Constructs a EndRecord record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from + * @param in unused (since this record has no data) */ - public EndRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { } @@ -64,9 +53,8 @@ public class EndRecord public int serialize(int offset, byte [] data) { - LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, - (( short ) 0)); // no record info + LittleEndian.putUShort(data, 0 + offset, sid); + LittleEndian.putUShort(data, 2 + offset, 0); // no record info return getRecordSize(); } diff --git a/src/java/org/apache/poi/hssf/record/EndSubRecord.java b/src/java/org/apache/poi/hssf/record/EndSubRecord.java index 59ccb872ed..e2d3808d84 100644 --- a/src/java/org/apache/poi/hssf/record/EndSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/EndSubRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -16,12 +15,9 @@ limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.LittleEndian; /** * The end data record is used to denote the end of the subrecords. @@ -30,10 +26,8 @@ import org.apache.poi.util.*; * @author Glen Stampoultzis (glens at apache.org) */ -public class EndSubRecord - extends SubRecord -{ - public final static short sid = 0x00; +public final class EndSubRecord extends SubRecord { + public final static short sid = 0x00; public EndSubRecord() @@ -42,18 +36,9 @@ public class EndSubRecord } /** - * Constructs a End record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from + * @param in unused (since this record has no data) */ - public EndSubRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { } diff --git a/src/java/org/apache/poi/hssf/record/EscherAggregate.java b/src/java/org/apache/poi/hssf/record/EscherAggregate.java index d62b59adbb..bfeb44751b 100644 --- a/src/java/org/apache/poi/hssf/record/EscherAggregate.java +++ b/src/java/org/apache/poi/hssf/record/EscherAggregate.java @@ -17,18 +17,41 @@ package org.apache.poi.hssf.record; -import org.apache.poi.ddf.*; -import org.apache.poi.hssf.usermodel.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.poi.ddf.DefaultEscherRecordFactory; +import org.apache.poi.ddf.EscherBoolProperty; +import org.apache.poi.ddf.EscherClientAnchorRecord; +import org.apache.poi.ddf.EscherClientDataRecord; +import org.apache.poi.ddf.EscherContainerRecord; +import org.apache.poi.ddf.EscherDgRecord; +import org.apache.poi.ddf.EscherDggRecord; +import org.apache.poi.ddf.EscherOptRecord; +import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherRecord; +import org.apache.poi.ddf.EscherRecordFactory; +import org.apache.poi.ddf.EscherSerializationListener; +import org.apache.poi.ddf.EscherSpRecord; +import org.apache.poi.ddf.EscherSpgrRecord; +import org.apache.poi.ddf.EscherTextboxRecord; import org.apache.poi.hssf.model.AbstractShape; -import org.apache.poi.hssf.model.TextboxShape; -import org.apache.poi.hssf.model.DrawingManager2; -import org.apache.poi.hssf.model.ConvertAnchor; import org.apache.poi.hssf.model.CommentShape; +import org.apache.poi.hssf.model.ConvertAnchor; +import org.apache.poi.hssf.model.DrawingManager2; +import org.apache.poi.hssf.model.TextboxShape; +import org.apache.poi.hssf.usermodel.HSSFClientAnchor; +import org.apache.poi.hssf.usermodel.HSSFPatriarch; +import org.apache.poi.hssf.usermodel.HSSFShape; +import org.apache.poi.hssf.usermodel.HSSFShapeContainer; +import org.apache.poi.hssf.usermodel.HSSFShapeGroup; +import org.apache.poi.hssf.usermodel.HSSFTextbox; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; -import java.util.*; - /** * This class is used to aggregate the MSODRAWING and OBJ record * combinations. This is necessary due to the bizare way in which @@ -282,16 +305,6 @@ public class EscherAggregate extends AbstractEscherHolderRecord return sid; } - /** - * Unused since this is an aggregate record. Use createAggregate(). - * - * @see #createAggregate - */ - protected void fillFields( byte[] data, short size, int offset ) - { - throw new IllegalStateException( "Should not reach here" ); - } - /** * Calculates the string representation of this record. This is * simply a dump of all the records. @@ -539,8 +552,7 @@ public class EscherAggregate extends AbstractEscherHolderRecord // The top level container ought to have // the DgRecord and the container of one container // per shape group (patriach overall first) - EscherContainerRecord topContainer = - (EscherContainerRecord)getEscherContainer(); + EscherContainerRecord topContainer = getEscherContainer(); if(topContainer == null) { return; } diff --git a/src/java/org/apache/poi/hssf/record/ExtSSTInfoSubRecord.java b/src/java/org/apache/poi/hssf/record/ExtSSTInfoSubRecord.java index e6e2317849..278bfd7816 100644 --- a/src/java/org/apache/poi/hssf/record/ExtSSTInfoSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExtSSTInfoSubRecord.java @@ -51,11 +51,6 @@ public class ExtSSTInfoSubRecord } public ExtSSTInfoSubRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_stream_pos = in.readInt(); field_2_bucket_sst_offset = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java b/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java index 0d99c53241..582668f331 100644 --- a/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java @@ -53,17 +53,7 @@ public class ExtSSTRecord field_2_sst_info = new ArrayList(); } - /** - * Constructs a EOFRecord record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public ExtSSTRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_2_sst_info = new ArrayList(); field_1_strings_per_bucket = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java b/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java index a4e81ba55e..0bc50ca89e 100644 --- a/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java @@ -195,17 +195,7 @@ public class ExtendedFormatRecord { } - /** - * Constructs an ExtendedFormat record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public ExtendedFormatRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_font_index = in.readShort(); field_2_format_index = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java b/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java index 71f0d496a1..f6266cfa35 100644 --- a/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java @@ -95,22 +95,13 @@ public class ExternSheetRecord extends Record { _list = new ArrayList(); } - /** - * Constructs a Extern Sheet record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - - public ExternSheetRecord(RecordInputStream in) { - super(in); - } - /** * called by the constructor, should set class level fields. Should throw * runtime exception for bad/icomplete data. * * @param in the RecordInputstream to read the record from */ - protected void fillFields(RecordInputStream in) { + public ExternSheetRecord(RecordInputStream in) { _list = new ArrayList(); int nItems = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java b/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java index 45deae1c62..d2135c085e 100755 --- a/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java @@ -47,11 +47,7 @@ public final class ExternalNameRecord extends Record { private short field_2_index; private short field_3_not_used; private String field_4_name; - private Ptg[] field_5_name_definition; // TODO - junits for name definition field - - public ExternalNameRecord(RecordInputStream in) { - super(in); - } + private Ptg[] field_5_name_definition; /** * Convenience Function to determine if the name is a built-in name @@ -116,13 +112,13 @@ public final class ExternalNameRecord extends Record { LittleEndian.putShort( data, 4 + offset, field_1_option_flag ); LittleEndian.putShort( data, 6 + offset, field_2_index ); LittleEndian.putShort( data, 8 + offset, field_3_not_used ); - short nameLen = (short) field_4_name.length(); - LittleEndian.putShort( data, 10 + offset, nameLen ); + int nameLen = field_4_name.length(); + LittleEndian.putUShort( data, 10 + offset, nameLen ); StringUtil.putCompressedUnicode( field_4_name, data, 12 + offset ); if(hasFormula()) { - short defLen = (short) getNameDefinitionSize(); - LittleEndian.putShort( data, 12 + nameLen + offset, defLen ); - Ptg.serializePtgStack(toStack(field_5_name_definition), data, 14 + nameLen + offset ); + int defLen = getNameDefinitionSize(); + LittleEndian.putUShort( data, 12 + nameLen + offset, defLen ); + Ptg.serializePtgs(field_5_name_definition, data, 14 + nameLen + offset ); } return dataSize + 4; } @@ -141,7 +137,7 @@ public final class ExternalNameRecord extends Record { } - protected void fillFields(RecordInputStream in) { + public ExternalNameRecord(RecordInputStream in) { field_1_option_flag = in.readShort(); field_2_index = in.readShort(); field_3_not_used = in.readShort(); @@ -158,7 +154,7 @@ public final class ExternalNameRecord extends Record { throw readFail("Ran out of record data trying to read formula."); } short formulaLen = in.readShort(); - field_5_name_definition = toPtgArray(Ptg.createParsedExpressionTokens(formulaLen, in)); + field_5_name_definition = Ptg.readTokens(formulaLen, in); } /* * Makes better error messages (while hasFormula() is not reliable) @@ -196,19 +192,6 @@ public final class ExternalNameRecord extends Record { return true; } - private static Ptg[] toPtgArray(Stack s) { - Ptg[] result = new Ptg[s.size()]; - s.toArray(result); - return result; - } - private static Stack toStack(Ptg[] ptgs) { - Stack result = new Stack(); - for (int i = 0; i < ptgs.length; i++) { - result.push(ptgs[i]); - } - return result; - } - public short getSid() { return sid; } diff --git a/src/java/org/apache/poi/hssf/record/FilePassRecord.java b/src/java/org/apache/poi/hssf/record/FilePassRecord.java index b14fac83a4..3af87278e2 100644 --- a/src/java/org/apache/poi/hssf/record/FilePassRecord.java +++ b/src/java/org/apache/poi/hssf/record/FilePassRecord.java @@ -40,17 +40,7 @@ public class FilePassRecord { } - /** - * Constructs a FILEPASS record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public FilePassRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_encryptedpassword = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/FileSharingRecord.java b/src/java/org/apache/poi/hssf/record/FileSharingRecord.java index e49c07785c..3631251995 100644 --- a/src/java/org/apache/poi/hssf/record/FileSharingRecord.java +++ b/src/java/org/apache/poi/hssf/record/FileSharingRecord.java @@ -36,18 +36,8 @@ public final class FileSharingRecord extends Record { private String field_3_username_value; public FileSharingRecord() {} - - - /** - * Constructs a FileSharing record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ public FileSharingRecord(RecordInputStream in) { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_readonly = in.readShort(); field_2_password = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/FnGroupCountRecord.java b/src/java/org/apache/poi/hssf/record/FnGroupCountRecord.java index abea11f5d7..23de9135af 100644 --- a/src/java/org/apache/poi/hssf/record/FnGroupCountRecord.java +++ b/src/java/org/apache/poi/hssf/record/FnGroupCountRecord.java @@ -46,17 +46,7 @@ public class FnGroupCountRecord { } - /** - * Constructs a FnGroupCount record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public FnGroupCountRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_count = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/FontBasisRecord.java b/src/java/org/apache/poi/hssf/record/FontBasisRecord.java index 95731d1025..645db716c0 100644 --- a/src/java/org/apache/poi/hssf/record/FontBasisRecord.java +++ b/src/java/org/apache/poi/hssf/record/FontBasisRecord.java @@ -46,19 +46,7 @@ public class FontBasisRecord } - /** - * Constructs a FontBasis record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public FontBasisRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_xBasis = in.readShort(); field_2_yBasis = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/FontIndexRecord.java b/src/java/org/apache/poi/hssf/record/FontIndexRecord.java index 82d7152e88..b2ece53175 100644 --- a/src/java/org/apache/poi/hssf/record/FontIndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/FontIndexRecord.java @@ -42,19 +42,7 @@ public class FontIndexRecord } - /** - * Constructs a FontIndex record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public FontIndexRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_fontIndex = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/FontRecord.java b/src/java/org/apache/poi/hssf/record/FontRecord.java index deaa92e266..e1d4219774 100644 --- a/src/java/org/apache/poi/hssf/record/FontRecord.java +++ b/src/java/org/apache/poi/hssf/record/FontRecord.java @@ -76,18 +76,7 @@ public class FontRecord { } - /** - * Constructs a Font record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public FontRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_font_height = in.readShort(); field_2_attributes = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/FooterRecord.java b/src/java/org/apache/poi/hssf/record/FooterRecord.java index 9dcd031189..8434792172 100644 --- a/src/java/org/apache/poi/hssf/record/FooterRecord.java +++ b/src/java/org/apache/poi/hssf/record/FooterRecord.java @@ -45,17 +45,7 @@ public class FooterRecord { } - /** - * Constructs a FooterRecord record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public FooterRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { if (in.remaining() > 0) { diff --git a/src/java/org/apache/poi/hssf/record/FormatRecord.java b/src/java/org/apache/poi/hssf/record/FormatRecord.java index 47a45c4f0e..b8f4ea22ad 100644 --- a/src/java/org/apache/poi/hssf/record/FormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/FormatRecord.java @@ -46,17 +46,7 @@ public class FormatRecord { } - /** - * Constructs a Format record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public FormatRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_index_code = in.readShort(); field_3_unicode_len = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/FormulaRecord.java b/src/java/org/apache/poi/hssf/record/FormulaRecord.java index 21ca8cccb5..a6c97d46ef 100644 --- a/src/java/org/apache/poi/hssf/record/FormulaRecord.java +++ b/src/java/org/apache/poi/hssf/record/FormulaRecord.java @@ -186,20 +186,7 @@ public final class FormulaRecord extends Record implements CellValueRecordInterf field_8_parsed_expr = Ptg.EMPTY_PTG_ARRAY; } - /** - * Constructs a Formula record and sets its fields appropriately. - * Note - id must be 0x06 (NOT 0x406 see MSKB #Q184647 for an - * "explanation of this bug in the documentation) or an exception - * will be throw upon validation - * - * @param in the RecordInputstream to read the record from - */ - public FormulaRecord(RecordInputStream in) { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_row = in.readUShort(); field_2_column = in.readShort(); field_3_xf = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/FrameRecord.java b/src/java/org/apache/poi/hssf/record/FrameRecord.java index 321c867d92..4425b0817d 100644 --- a/src/java/org/apache/poi/hssf/record/FrameRecord.java +++ b/src/java/org/apache/poi/hssf/record/FrameRecord.java @@ -46,19 +46,7 @@ public final class FrameRecord extends Record { } - /** - * Constructs a Frame record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public FrameRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_borderType = in.readShort(); field_2_options = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/GridsetRecord.java b/src/java/org/apache/poi/hssf/record/GridsetRecord.java index 681b7cdc14..ad652ba824 100644 --- a/src/java/org/apache/poi/hssf/record/GridsetRecord.java +++ b/src/java/org/apache/poi/hssf/record/GridsetRecord.java @@ -44,17 +44,7 @@ public class GridsetRecord { } - /** - * Constructs a GridSet record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public GridsetRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_gridset_flag = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java b/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java index d72b4be65b..0618ea6f4f 100644 --- a/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java @@ -41,19 +41,7 @@ public class GroupMarkerSubRecord } - /** - * Constructs a group marker record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public GroupMarkerSubRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { // int pos = 0; reserved = in.readRemainder(); diff --git a/src/java/org/apache/poi/hssf/record/GutsRecord.java b/src/java/org/apache/poi/hssf/record/GutsRecord.java index d165439215..0073066ec1 100644 --- a/src/java/org/apache/poi/hssf/record/GutsRecord.java +++ b/src/java/org/apache/poi/hssf/record/GutsRecord.java @@ -43,17 +43,7 @@ public class GutsRecord { } - /** - * Constructs a Guts record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public GutsRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_left_row_gutter = in.readShort(); field_2_top_col_gutter = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/HCenterRecord.java b/src/java/org/apache/poi/hssf/record/HCenterRecord.java index cfcdb00afe..261431e716 100644 --- a/src/java/org/apache/poi/hssf/record/HCenterRecord.java +++ b/src/java/org/apache/poi/hssf/record/HCenterRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,42 +14,28 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; import org.apache.poi.util.LittleEndian; /** - * Title: HCenter record

+ * Title: HCenter record (0x0083)

* Description: whether to center between horizontal margins

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

* @author Andrew C. Oliver (acoliver at apache dot org) * @author Jason Height (jheight at chariot dot net dot au) * @version 2.0-pre */ - -public class HCenterRecord - extends Record -{ - public final static short sid = 0x83; +public final class HCenterRecord extends Record { + public final static short sid = 0x0083; private short field_1_hcenter; public HCenterRecord() { } - /** - * Constructs an HCenter record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public HCenterRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_hcenter = in.readShort(); } @@ -96,8 +81,8 @@ public class HCenterRecord public int serialize(int offset, byte [] data) { LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, ( short ) 0x2); - LittleEndian.putShort(data, 4 + offset, ( short ) field_1_hcenter); + LittleEndian.putUShort(data, 2 + offset, 0x2); + LittleEndian.putUShort(data, 4 + offset, field_1_hcenter); return getRecordSize(); } diff --git a/src/java/org/apache/poi/hssf/record/HeaderRecord.java b/src/java/org/apache/poi/hssf/record/HeaderRecord.java index 57846ee73c..61ff851306 100644 --- a/src/java/org/apache/poi/hssf/record/HeaderRecord.java +++ b/src/java/org/apache/poi/hssf/record/HeaderRecord.java @@ -45,17 +45,7 @@ public class HeaderRecord { } - /** - * Constructs an Header record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public HeaderRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { if (in.remaining() > 0) { diff --git a/src/java/org/apache/poi/hssf/record/HideObjRecord.java b/src/java/org/apache/poi/hssf/record/HideObjRecord.java index 2786de4571..496002618a 100644 --- a/src/java/org/apache/poi/hssf/record/HideObjRecord.java +++ b/src/java/org/apache/poi/hssf/record/HideObjRecord.java @@ -42,17 +42,7 @@ public class HideObjRecord { } - /** - * Constructs an HideObj record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public HideObjRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_hide_obj = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java b/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java index 6daf192ca2..6fc5b97163 100644 --- a/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java +++ b/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java @@ -130,16 +130,6 @@ public class HyperlinkRecord extends Record { } - /** - * Read hyperlink from input stream - * - * @param in the stream to read from - */ - public HyperlinkRecord(RecordInputStream in) - { - super(in); - } - /** * Return the column of the first cell that contains the hyperlink * @@ -315,7 +305,7 @@ public class HyperlinkRecord extends Record { /** * @param in the RecordInputstream to read the record from */ - protected void fillFields(RecordInputStream in) + public HyperlinkRecord(RecordInputStream in) { try { rwFirst = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/IndexRecord.java b/src/java/org/apache/poi/hssf/record/IndexRecord.java index d997a43dd8..c7c3cfbb5a 100644 --- a/src/java/org/apache/poi/hssf/record/IndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/IndexRecord.java @@ -48,17 +48,7 @@ public class IndexRecord { } - /** - * Constructs an Index record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public IndexRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_5_dbcells = new IntList(DBCELL_CAPACITY); // initial capacity of 30 diff --git a/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java b/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java index 8f91b197ec..2a9de8e563 100644 --- a/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java +++ b/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,41 +14,30 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; import org.apache.poi.util.LittleEndian; /** - * Title: Interface End Record

+ * Title: Interface End Record (0x00E2)

* Description: Shows where the Interface Records end (MMS) * (has no fields)

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

* @author Andrew C. Oliver (acoliver at apache dot org) * @version 2.0-pre */ - -public class InterfaceEndRecord - extends Record -{ - public final static short sid = 0xe2; +public final class InterfaceEndRecord extends Record { + public final static short sid = 0x00E2; public InterfaceEndRecord() { } /** - * Constructs an InterfaceEnd record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from + * @param in unused (since this record has no data) */ - public InterfaceEndRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { } diff --git a/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java b/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java index 5e04b506ab..617e95855f 100644 --- a/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java +++ b/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java @@ -45,17 +45,7 @@ public class InterfaceHdrRecord { } - /** - * Constructs an Codepage record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public InterfaceHdrRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_codepage = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/IterationRecord.java b/src/java/org/apache/poi/hssf/record/IterationRecord.java index 82e167f79e..400ee0a8c5 100644 --- a/src/java/org/apache/poi/hssf/record/IterationRecord.java +++ b/src/java/org/apache/poi/hssf/record/IterationRecord.java @@ -43,17 +43,7 @@ public class IterationRecord { } - /** - * Constructs an Iteration record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public IterationRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_iteration = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/LabelRecord.java b/src/java/org/apache/poi/hssf/record/LabelRecord.java index 32b910b841..f4bbfb85da 100644 --- a/src/java/org/apache/poi/hssf/record/LabelRecord.java +++ b/src/java/org/apache/poi/hssf/record/LabelRecord.java @@ -44,19 +44,9 @@ public final class LabelRecord extends Record implements CellValueRecordInterfac } /** - * Constructs an Label record and sets its fields appropriately. - * * @param in the RecordInputstream to read the record from */ public LabelRecord(RecordInputStream in) - { - super(in); - } - - /** - * @param in the RecordInputstream to read the record from - */ - protected void fillFields(RecordInputStream in) { field_1_row = in.readUShort(); field_2_column = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java b/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java index 3d878770d4..f2eae83deb 100644 --- a/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java +++ b/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java @@ -40,16 +40,7 @@ public final class LabelSSTRecord extends Record implements CellValueRecordInter { } - /** - * Constructs an LabelSST record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ public LabelSSTRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_row = in.readUShort(); field_2_column = in.readUShort(); diff --git a/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java b/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java index ebe59a3376..92da85ceaa 100644 --- a/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java @@ -31,15 +31,7 @@ public class LeftMarginRecord extends Record implements Margin public LeftMarginRecord() { } - /** - * Constructs a LeftMargin record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ public LeftMarginRecord(RecordInputStream in) - { super(in); } - - protected void fillFields(RecordInputStream in) { field_1_margin = in.readDouble(); } @@ -93,4 +85,4 @@ public class LeftMarginRecord extends Record implements Margin rec.field_1_margin = this.field_1_margin; return rec; } -} // END OF CLASS \ No newline at end of file +} // END OF CLAS \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/LegendRecord.java b/src/java/org/apache/poi/hssf/record/LegendRecord.java index 46ccd6b659..08ff6513fc 100644 --- a/src/java/org/apache/poi/hssf/record/LegendRecord.java +++ b/src/java/org/apache/poi/hssf/record/LegendRecord.java @@ -62,19 +62,7 @@ public final class LegendRecord extends Record { } - /** - * Constructs a Legend record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public LegendRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_xAxisUpperLeft = in.readInt(); field_2_yAxisUpperLeft = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/LineFormatRecord.java b/src/java/org/apache/poi/hssf/record/LineFormatRecord.java index 88fafe10a2..c3f0197f38 100644 --- a/src/java/org/apache/poi/hssf/record/LineFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/LineFormatRecord.java @@ -61,19 +61,7 @@ public final class LineFormatRecord extends Record { } - /** - * Constructs a LineFormat record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public LineFormatRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_lineColor = in.readInt(); field_2_linePattern = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/LinkedDataFormulaField.java b/src/java/org/apache/poi/hssf/record/LinkedDataFormulaField.java index be5d1fd841..9e82adec6e 100644 --- a/src/java/org/apache/poi/hssf/record/LinkedDataFormulaField.java +++ b/src/java/org/apache/poi/hssf/record/LinkedDataFormulaField.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; @@ -31,9 +29,7 @@ import java.util.Iterator; * * @author Glen Stampoultzis (glens at apache.org) */ -public class LinkedDataFormulaField - implements CustomField -{ +public final class LinkedDataFormulaField implements CustomField { Stack formulaTokens = new Stack(); public int getSize() diff --git a/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java b/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java index 6e0dc8296a..673fc85f4b 100644 --- a/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java +++ b/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java @@ -54,19 +54,7 @@ public final class LinkedDataRecord extends Record { } - /** - * Constructs a LinkedData record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public LinkedDataRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_linkType = in.readByte(); field_2_referenceType = in.readByte(); @@ -142,7 +130,7 @@ public final class LinkedDataRecord extends Record { rec.field_2_referenceType = field_2_referenceType; rec.field_3_options = field_3_options; rec.field_4_indexNumberFmtRecord = field_4_indexNumberFmtRecord; - rec.field_5_formulaOfLink = ((LinkedDataFormulaField)field_5_formulaOfLink.clone());; + rec.field_5_formulaOfLink = ((LinkedDataFormulaField)field_5_formulaOfLink.clone()); return rec; } diff --git a/src/java/org/apache/poi/hssf/record/MMSRecord.java b/src/java/org/apache/poi/hssf/record/MMSRecord.java index 3ee9665692..c11e2d510d 100644 --- a/src/java/org/apache/poi/hssf/record/MMSRecord.java +++ b/src/java/org/apache/poi/hssf/record/MMSRecord.java @@ -41,17 +41,7 @@ public class MMSRecord { } - /** - * Constructs a MMS record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public MMSRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_addMenuCount = in.readByte(); field_2_delMenuCount = in.readByte(); diff --git a/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java b/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java index aac11ef603..5c7da42aa9 100644 --- a/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java +++ b/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java @@ -56,9 +56,6 @@ public final class MergeCellsRecord extends Record { _startIndex = 0; _regions = cras; } - protected void fillFields(RecordInputStream in) { - throw new RuntimeException("obsolete"); - } /** * get the number of merged areas. If this drops down to 0 you should just go * ahead and delete the record. diff --git a/src/java/org/apache/poi/hssf/record/MulBlankRecord.java b/src/java/org/apache/poi/hssf/record/MulBlankRecord.java index 0bfeea9ffc..8d461fe975 100644 --- a/src/java/org/apache/poi/hssf/record/MulBlankRecord.java +++ b/src/java/org/apache/poi/hssf/record/MulBlankRecord.java @@ -52,17 +52,6 @@ public class MulBlankRecord { } - /** - * Constructs a MulBlank record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - - public MulBlankRecord(RecordInputStream in) - { - super(in); - } - /** * get the row number of the cells this represents * @@ -119,7 +108,7 @@ public class MulBlankRecord /** * @param in the RecordInputstream to read the record from */ - protected void fillFields(RecordInputStream in) + public MulBlankRecord(RecordInputStream in) { //field_1_row = LittleEndian.getShort(data, 0 + offset); field_1_row = in.readUShort(); diff --git a/src/java/org/apache/poi/hssf/record/MulRKRecord.java b/src/java/org/apache/poi/hssf/record/MulRKRecord.java index 4f2981f5da..0419f4921d 100644 --- a/src/java/org/apache/poi/hssf/record/MulRKRecord.java +++ b/src/java/org/apache/poi/hssf/record/MulRKRecord.java @@ -37,15 +37,6 @@ public final class MulRKRecord extends Record { private RkRec[] field_3_rks; private short field_4_last_col; - /** - * Constructs a MulRK record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public MulRKRecord(RecordInputStream in) { - super(in); - } - public int getRow() { return field_1_row; } @@ -93,7 +84,7 @@ public final class MulRKRecord extends Record { /** * @param in the RecordInputstream to read the record from */ - protected void fillFields(RecordInputStream in) { + public MulRKRecord(RecordInputStream in) { field_1_row = in.readUShort(); field_2_first_col = in.readShort(); field_3_rks = RkRec.parseRKs(in); diff --git a/src/java/org/apache/poi/hssf/record/NameRecord.java b/src/java/org/apache/poi/hssf/record/NameRecord.java index 732172add7..93f4ce6cd7 100644 --- a/src/java/org/apache/poi/hssf/record/NameRecord.java +++ b/src/java/org/apache/poi/hssf/record/NameRecord.java @@ -107,15 +107,6 @@ public final class NameRecord extends Record { field_17_status_bar_text = ""; } - /** - * Constructs a Name record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public NameRecord(RecordInputStream in) { - super(in); - } - /** * Constructor to create a built-in named region * @param builtin Built-in byte representation for the name record, use the public constants @@ -539,7 +530,7 @@ public final class NameRecord extends Record { * * @param in the RecordInputstream to read the record from */ - protected void fillFields(RecordInputStream in) { + public NameRecord(RecordInputStream in) { field_1_option_flag = in.readShort(); field_2_keyboard_shortcut = in.readByte(); int field_3_length_name_text = in.readByte(); diff --git a/src/java/org/apache/poi/hssf/record/NoteRecord.java b/src/java/org/apache/poi/hssf/record/NoteRecord.java index c37bd08545..2f506f115d 100644 --- a/src/java/org/apache/poi/hssf/record/NoteRecord.java +++ b/src/java/org/apache/poi/hssf/record/NoteRecord.java @@ -53,18 +53,6 @@ public class NoteRecord extends Record { field_3_flags = 0; } - /** - * Constructs a NoteRecord and fills its fields - * from the supplied RecordInputStream. - * - * @param in the stream to read from - */ - public NoteRecord(RecordInputStream in) - { - super(in); - - } - /** * @return id of this record. */ @@ -76,7 +64,7 @@ public class NoteRecord extends Record { /** * Read the record data from the supplied RecordInputStream */ - protected void fillFields(RecordInputStream in) + public NoteRecord(RecordInputStream in) { field_1_row = in.readShort(); field_2_col = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java b/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java index a0b519594c..4b96a0ee45 100644 --- a/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java @@ -45,20 +45,10 @@ public class NoteStructureSubRecord reserved = new byte[22]; } - /** - * Constructs a NoteStructureSubRecord and sets its fields appropriately. - * - */ - public NoteStructureSubRecord(RecordInputStream in) - { - super(in); - - } - /** * Read the record data from the supplied RecordInputStream */ - protected void fillFields(RecordInputStream in) + public NoteStructureSubRecord(RecordInputStream in) { //just grab the raw data reserved = in.readRemainder(); diff --git a/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java b/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java index 951e53360a..00307e141f 100644 --- a/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java @@ -42,19 +42,7 @@ public class NumberFormatIndexRecord } - /** - * Constructs a NumberFormatIndex record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public NumberFormatIndexRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_formatIndex = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/NumberRecord.java b/src/java/org/apache/poi/hssf/record/NumberRecord.java index 0877985adc..e4283f0eac 100644 --- a/src/java/org/apache/poi/hssf/record/NumberRecord.java +++ b/src/java/org/apache/poi/hssf/record/NumberRecord.java @@ -41,19 +41,9 @@ public final class NumberRecord extends Record implements CellValueRecordInterfa } /** - * Constructs a Number record and sets its fields appropriately. - * * @param in the RecordInputstream to read the record from */ public NumberRecord(RecordInputStream in) - { - super(in); - } - - /** - * @param in the RecordInputstream to read the record from - */ - protected void fillFields(RecordInputStream in) { field_1_row = in.readUShort(); field_2_col = in.readUShort(); diff --git a/src/java/org/apache/poi/hssf/record/ObjRecord.java b/src/java/org/apache/poi/hssf/record/ObjRecord.java index 0e85817a2b..03ea7d1f55 100644 --- a/src/java/org/apache/poi/hssf/record/ObjRecord.java +++ b/src/java/org/apache/poi/hssf/record/ObjRecord.java @@ -43,18 +43,7 @@ public final class ObjRecord extends Record { // TODO - ensure 2 sub-records (ftCmo 15h, and ftEnd 00h) are always created } - /** - * Constructs a OBJ record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public ObjRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { // TODO - problems with OBJ sub-records stream // MS spec says first sub-records is always CommonObjectDataSubRecord, and last is diff --git a/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java b/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java index ec32ef0fa7..7a86fe2ec4 100644 --- a/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java +++ b/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java @@ -49,19 +49,7 @@ public class ObjectLinkRecord } - /** - * Constructs a ObjectLink record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public ObjectLinkRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_anchorId = in.readShort(); field_2_link1 = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java b/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java index 0dbb95c21e..cdbb56d873 100644 --- a/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java +++ b/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java @@ -41,17 +41,7 @@ public class ObjectProtectRecord { } - /** - * Constructs a Protect record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public ObjectProtectRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_protect = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/PageBreakRecord.java b/src/java/org/apache/poi/hssf/record/PageBreakRecord.java index f11e3395cd..654439f316 100644 --- a/src/java/org/apache/poi/hssf/record/PageBreakRecord.java +++ b/src/java/org/apache/poi/hssf/record/PageBreakRecord.java @@ -83,11 +83,7 @@ public abstract class PageBreakRecord extends Record { _breakMap = new HashMap(); } - protected PageBreakRecord(RecordInputStream in) { - super(in); - } - - protected void fillFields(RecordInputStream in) + public PageBreakRecord(RecordInputStream in) { int nBreaks = in.readShort(); _breaks = new ArrayList(nBreaks + 2); diff --git a/src/java/org/apache/poi/hssf/record/PaletteRecord.java b/src/java/org/apache/poi/hssf/record/PaletteRecord.java index 6fd4682173..0cf7856361 100644 --- a/src/java/org/apache/poi/hssf/record/PaletteRecord.java +++ b/src/java/org/apache/poi/hssf/record/PaletteRecord.java @@ -48,17 +48,7 @@ public class PaletteRecord createDefaultPalette(); } - /** - * Constructs a PaletteRecord record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public PaletteRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_numcolors = in.readShort(); field_2_colors = new ArrayList(field_1_numcolors); diff --git a/src/java/org/apache/poi/hssf/record/PaneRecord.java b/src/java/org/apache/poi/hssf/record/PaneRecord.java index c8e4df55b6..f02b0795b9 100644 --- a/src/java/org/apache/poi/hssf/record/PaneRecord.java +++ b/src/java/org/apache/poi/hssf/record/PaneRecord.java @@ -49,19 +49,7 @@ public final class PaneRecord extends Record { } - /** - * Constructs a Pane record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public PaneRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_x = in.readShort(); field_2_y = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/PasswordRecord.java b/src/java/org/apache/poi/hssf/record/PasswordRecord.java index 1b9e9041ac..b7b9d075ab 100644 --- a/src/java/org/apache/poi/hssf/record/PasswordRecord.java +++ b/src/java/org/apache/poi/hssf/record/PasswordRecord.java @@ -36,16 +36,7 @@ public class PasswordRecord extends Record { public PasswordRecord() { } - /** - * Constructs a Password record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public PasswordRecord(RecordInputStream in) { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_password = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/PasswordRev4Record.java b/src/java/org/apache/poi/hssf/record/PasswordRev4Record.java index 5a096b1d26..5c5567a86b 100644 --- a/src/java/org/apache/poi/hssf/record/PasswordRev4Record.java +++ b/src/java/org/apache/poi/hssf/record/PasswordRev4Record.java @@ -40,17 +40,7 @@ public class PasswordRev4Record { } - /** - * Constructs a PasswordRev4 (PROT4REVPASS) record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public PasswordRev4Record(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_password = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java b/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java index c41c3f2f7d..e678eac782 100644 --- a/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java +++ b/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,13 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.LittleEndian; /** * preceeds and identifies a frame as belonging to the plot area. @@ -30,9 +26,7 @@ import org.apache.poi.util.*; * @author Andrew C. Oliver (acoliver at apache.org) */ -public class PlotAreaRecord - extends Record -{ +public final class PlotAreaRecord extends Record { public final static short sid = 0x1035; @@ -42,18 +36,9 @@ public class PlotAreaRecord } /** - * Constructs a PlotArea record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from + * @param in unused (since this record has no data) */ - public PlotAreaRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { } diff --git a/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java b/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java index b340fe604a..9df6811e2a 100644 --- a/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java +++ b/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java @@ -43,19 +43,7 @@ public class PlotGrowthRecord } - /** - * Constructs a PlotGrowth record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public PlotGrowthRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_horizontalScale = in.readInt(); field_2_verticalScale = in.readInt(); diff --git a/src/java/org/apache/poi/hssf/record/PrecisionRecord.java b/src/java/org/apache/poi/hssf/record/PrecisionRecord.java index 57e390df46..a147cfff18 100644 --- a/src/java/org/apache/poi/hssf/record/PrecisionRecord.java +++ b/src/java/org/apache/poi/hssf/record/PrecisionRecord.java @@ -40,17 +40,7 @@ public class PrecisionRecord { } - /** - * Constructs a Precision record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public PrecisionRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_precision = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java b/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java index 3908e01660..7b4de7c68e 100644 --- a/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java +++ b/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java @@ -40,17 +40,7 @@ public class PrintGridlinesRecord { } - /** - * Constructs a PrintGridlines record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public PrintGridlinesRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_print_gridlines = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java b/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java index 80521050c3..61c1cce86e 100644 --- a/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java +++ b/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java @@ -41,17 +41,7 @@ public class PrintHeadersRecord { } - /** - * Constructs a PrintHeaders record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public PrintHeadersRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_print_headers = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/PrintSetupRecord.java b/src/java/org/apache/poi/hssf/record/PrintSetupRecord.java index 91ab614543..e41f278d54 100644 --- a/src/java/org/apache/poi/hssf/record/PrintSetupRecord.java +++ b/src/java/org/apache/poi/hssf/record/PrintSetupRecord.java @@ -66,17 +66,7 @@ public class PrintSetupRecord extends Record { { } - /** - * Constructs a PrintSetup (SETUP) record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public PrintSetupRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_paper_size = in.readShort(); field_2_scale = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/ProtectRecord.java b/src/java/org/apache/poi/hssf/record/ProtectRecord.java index b6b5378c74..d5425c5523 100644 --- a/src/java/org/apache/poi/hssf/record/ProtectRecord.java +++ b/src/java/org/apache/poi/hssf/record/ProtectRecord.java @@ -42,17 +42,7 @@ public class ProtectRecord { } - /** - * Constructs a Protect record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public ProtectRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_protect = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/ProtectionRev4Record.java b/src/java/org/apache/poi/hssf/record/ProtectionRev4Record.java index c0e650f4ec..b7d2f4323f 100644 --- a/src/java/org/apache/poi/hssf/record/ProtectionRev4Record.java +++ b/src/java/org/apache/poi/hssf/record/ProtectionRev4Record.java @@ -40,17 +40,7 @@ public class ProtectionRev4Record { } - /** - * Constructs a ProtectionRev4 record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public ProtectionRev4Record(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_protect = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/RKRecord.java b/src/java/org/apache/poi/hssf/record/RKRecord.java index b899df4651..c4b25a5bea 100644 --- a/src/java/org/apache/poi/hssf/record/RKRecord.java +++ b/src/java/org/apache/poi/hssf/record/RKRecord.java @@ -52,16 +52,7 @@ public final class RKRecord extends Record implements CellValueRecordInterface { { } - /** - * Constructs a RK record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ public RKRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_row = in.readUShort(); field_2_col = in.readUShort(); diff --git a/src/java/org/apache/poi/hssf/record/RecalcIdRecord.java b/src/java/org/apache/poi/hssf/record/RecalcIdRecord.java index 008ee82e6d..c0cab053c9 100644 --- a/src/java/org/apache/poi/hssf/record/RecalcIdRecord.java +++ b/src/java/org/apache/poi/hssf/record/RecalcIdRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; @@ -37,9 +35,7 @@ import org.apache.poi.util.LittleEndian; * @see org.apache.poi.hssf.model.Workbook */ -public class RecalcIdRecord - extends Record -{ +public final class RecalcIdRecord extends Record { public final static short sid = 0x1c1; public short[] field_1_recalcids; @@ -49,17 +45,7 @@ public class RecalcIdRecord { } - /** - * Constructs a RECALCID record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public RecalcIdRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_recalcids = new short[ in.remaining() / 2 ]; for (int k = 0; k < field_1_recalcids.length; k++) @@ -118,9 +104,8 @@ public class RecalcIdRecord short length = ( short ) (tabids.length * 2); int byteoffset = 4; - LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, - (( short ) length)); + LittleEndian.putUShort(data, 0 + offset, sid); + LittleEndian.putUShort(data, 2 + offset, length); // 2 (num bytes in a short) for (int k = 0; k < (length / 2); k++) diff --git a/src/java/org/apache/poi/hssf/record/Record.java b/src/java/org/apache/poi/hssf/record/Record.java index a18869f073..29c37d7047 100644 --- a/src/java/org/apache/poi/hssf/record/Record.java +++ b/src/java/org/apache/poi/hssf/record/Record.java @@ -40,25 +40,6 @@ public abstract class Record extends RecordBase { { } - /** - * Constructor Record - * - * @param in the RecordInputstream to read the record from - */ - protected Record(RecordInputStream in) - { - fillFields(in); - } - - /** - * called by the constructor, should set class level fields. Should throw - * runtime exception for bad/icomplete data. - * - * @param in the RecordInputstream to read the record from - */ - - protected abstract void fillFields(RecordInputStream in); - /** * called by the class that is responsible for writing this sucker. * Subclasses should implement this so that their data is passed back in a diff --git a/src/java/org/apache/poi/hssf/record/RefModeRecord.java b/src/java/org/apache/poi/hssf/record/RefModeRecord.java index 632d0d3b58..f0567509bf 100644 --- a/src/java/org/apache/poi/hssf/record/RefModeRecord.java +++ b/src/java/org/apache/poi/hssf/record/RefModeRecord.java @@ -42,17 +42,7 @@ public class RefModeRecord { } - /** - * Constructs a RefMode record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public RefModeRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_mode = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/RefreshAllRecord.java b/src/java/org/apache/poi/hssf/record/RefreshAllRecord.java index 624001beac..021a34c69b 100644 --- a/src/java/org/apache/poi/hssf/record/RefreshAllRecord.java +++ b/src/java/org/apache/poi/hssf/record/RefreshAllRecord.java @@ -40,17 +40,7 @@ public class RefreshAllRecord { } - /** - * Constructs a RefreshAll record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public RefreshAllRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_refreshall = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/RightMarginRecord.java b/src/java/org/apache/poi/hssf/record/RightMarginRecord.java index 9e76010a34..75cdb2c2f3 100644 --- a/src/java/org/apache/poi/hssf/record/RightMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/RightMarginRecord.java @@ -30,13 +30,7 @@ public class RightMarginRecord extends Record implements Margin public RightMarginRecord() { } - /** - * Constructs a RightMargin record and sets its fields appropriately. * * @param id id must be 0x27 or an exception * will be throw upon validation * @param size size the size of the data area of the record * @param data data of the record (should not contain sid/len) - */ public RightMarginRecord( RecordInputStream in ) - { super( in ); } - - protected void fillFields( RecordInputStream in ) { field_1_margin = in.readDouble(); } @@ -82,4 +76,4 @@ public class RightMarginRecord extends Record implements Margin rec.field_1_margin = this.field_1_margin; return rec; } -} // END OF CLAS \ No newline at end of file +} // END OF CLA \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/RowRecord.java b/src/java/org/apache/poi/hssf/record/RowRecord.java index a5e5cd1e85..f893bf2831 100644 --- a/src/java/org/apache/poi/hssf/record/RowRecord.java +++ b/src/java/org/apache/poi/hssf/record/RowRecord.java @@ -74,16 +74,7 @@ public final class RowRecord extends Record { field_8_xf_index = ( short ) 0xf; } - /** - * Constructs a Row record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ public RowRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_row_number = in.readUShort(); field_2_first_col = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/SCLRecord.java b/src/java/org/apache/poi/hssf/record/SCLRecord.java index 41cbdee165..7295ad61ed 100644 --- a/src/java/org/apache/poi/hssf/record/SCLRecord.java +++ b/src/java/org/apache/poi/hssf/record/SCLRecord.java @@ -43,19 +43,7 @@ public class SCLRecord } - /** - * Constructs a SCL record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public SCLRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_numerator = in.readShort(); field_2_denominator = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/SSTRecord.java b/src/java/org/apache/poi/hssf/record/SSTRecord.java index 7f3477b63f..ca75af00d4 100644 --- a/src/java/org/apache/poi/hssf/record/SSTRecord.java +++ b/src/java/org/apache/poi/hssf/record/SSTRecord.java @@ -90,17 +90,6 @@ public class SSTRecord deserializer = new SSTDeserializer(field_3_strings); } - /** - * Constructs an SST record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - - public SSTRecord( RecordInputStream in ) - { - super( in ); - } - /** * Add a string. * @@ -335,7 +324,7 @@ public class SSTRecord * @param in the RecordInputstream to read the record from */ - protected void fillFields( RecordInputStream in ) + public SSTRecord( RecordInputStream in ) { // this method is ALWAYS called after construction -- using // the nontrivial constructor, of course -- so this is where diff --git a/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java b/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java index 2304639dbd..9cf008fe18 100644 --- a/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java +++ b/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java @@ -40,17 +40,7 @@ public class SaveRecalcRecord { } - /** - * Constructs an SaveRecalc record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public SaveRecalcRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_recalc = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/ScenarioProtectRecord.java b/src/java/org/apache/poi/hssf/record/ScenarioProtectRecord.java index 9140f342b8..037eed0206 100644 --- a/src/java/org/apache/poi/hssf/record/ScenarioProtectRecord.java +++ b/src/java/org/apache/poi/hssf/record/ScenarioProtectRecord.java @@ -42,17 +42,7 @@ public class ScenarioProtectRecord { } - /** - * Constructs a Protect record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public ScenarioProtectRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_protect = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/SelectionRecord.java b/src/java/org/apache/poi/hssf/record/SelectionRecord.java index c83b3e4da6..ca2bf22fc1 100644 --- a/src/java/org/apache/poi/hssf/record/SelectionRecord.java +++ b/src/java/org/apache/poi/hssf/record/SelectionRecord.java @@ -51,15 +51,7 @@ public final class SelectionRecord extends Record { }; } - /** - * Constructs a Selection record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ public SelectionRecord(RecordInputStream in) { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_pane = in.readByte(); field_2_row_active_cell = in.readUShort(); field_3_col_active_cell = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java b/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java index ce1fa3d838..acc9665ae3 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java @@ -42,19 +42,7 @@ public class SeriesChartGroupIndexRecord } - /** - * Constructs a SeriesChartGroupIndex record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public SeriesChartGroupIndexRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_chartGroupIndex = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java b/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java index 3f3f88803e..6896a0a217 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java @@ -42,19 +42,7 @@ public class SeriesIndexRecord } - /** - * Constructs a SeriesIndex record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public SeriesIndexRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_index = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java b/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java index 8ee1690e69..a3e8089bfb 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java @@ -46,19 +46,7 @@ public final class SeriesLabelsRecord extends Record { } - /** - * Constructs a SeriesLabels record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public SeriesLabelsRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_formatFlags = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/SeriesListRecord.java b/src/java/org/apache/poi/hssf/record/SeriesListRecord.java index d47f6b82bd..2894f15877 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesListRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesListRecord.java @@ -42,19 +42,7 @@ public class SeriesListRecord } - /** - * Constructs a SeriesList record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public SeriesListRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_seriesNumbers = in.readShortArray(); } diff --git a/src/java/org/apache/poi/hssf/record/SeriesRecord.java b/src/java/org/apache/poi/hssf/record/SeriesRecord.java index 95fbd79b5a..34b3c94a66 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesRecord.java @@ -59,19 +59,7 @@ public class SeriesRecord } - /** - * Constructs a Series record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public SeriesRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_categoryDataType = in.readShort(); field_2_valuesDataType = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java b/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java index b451b57c79..a445dc6166 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java @@ -45,19 +45,7 @@ public class SeriesTextRecord } - /** - * Constructs a SeriesText record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public SeriesTextRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_id = in.readShort(); field_2_textLength = in.readByte(); diff --git a/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java b/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java index 94877c6027..ff69ec5469 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java @@ -42,19 +42,7 @@ public class SeriesToChartGroupRecord } - /** - * Constructs a SeriesToChartGroup record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public SeriesToChartGroupRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_chartGroupIndex = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java b/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java index fe4e8b5829..fc51de8465 100644 --- a/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java +++ b/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java @@ -86,10 +86,6 @@ public abstract class SharedValueRecordBase extends Record { return dataSize + 4; } - protected final void fillFields(RecordInputStream in) { - throw new RuntimeException("Should not be called. Fields are filled in constructor"); - } - /** * @return true if (rowIx, colIx) is within the range ({@link #getRange()}) * of this shared value object. diff --git a/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java b/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java index 1cd6833537..9ae777e1e6 100644 --- a/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java +++ b/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java @@ -50,19 +50,7 @@ public final class SheetPropertiesRecord extends Record { } - /** - * Constructs a SheetProperties record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public SheetPropertiesRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_flags = in.readShort(); field_2_empty = in.readByte(); diff --git a/src/java/org/apache/poi/hssf/record/StringRecord.java b/src/java/org/apache/poi/hssf/record/StringRecord.java index 41154b6185..e4e71f7db8 100644 --- a/src/java/org/apache/poi/hssf/record/StringRecord.java +++ b/src/java/org/apache/poi/hssf/record/StringRecord.java @@ -36,20 +36,10 @@ public class StringRecord extends Record { { } - /** - * Constructs a String record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public StringRecord(RecordInputStream in) - { - super(in); - } - /** * @param in the RecordInputstream to read the record from */ - protected void fillFields( RecordInputStream in) + public StringRecord( RecordInputStream in) { field_1_string_length = in.readShort(); field_2_unicode_flag = in.readByte(); diff --git a/src/java/org/apache/poi/hssf/record/StyleRecord.java b/src/java/org/apache/poi/hssf/record/StyleRecord.java index 3dc0954314..5b746e8d4b 100644 --- a/src/java/org/apache/poi/hssf/record/StyleRecord.java +++ b/src/java/org/apache/poi/hssf/record/StyleRecord.java @@ -54,17 +54,7 @@ public final class StyleRecord extends Record { { } - /** - * Constructs a Style record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public StyleRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_xf_index = in.readShort(); if (getType() == STYLE_BUILT_IN) diff --git a/src/java/org/apache/poi/hssf/record/SubRecord.java b/src/java/org/apache/poi/hssf/record/SubRecord.java index 6b836c6ca6..1333ef1910 100644 --- a/src/java/org/apache/poi/hssf/record/SubRecord.java +++ b/src/java/org/apache/poi/hssf/record/SubRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,23 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; /** * Subrecords are part of the OBJ class. */ -abstract public class SubRecord - extends Record -{ - public SubRecord() - { - } - - public SubRecord( RecordInputStream in ) - { - super( in ); +abstract public class SubRecord extends Record { + protected SubRecord() { } public static Record createSubRecord(RecordInputStream in) diff --git a/src/java/org/apache/poi/hssf/record/SupBookRecord.java b/src/java/org/apache/poi/hssf/record/SupBookRecord.java index 66fe24451d..30e337e2d5 100644 --- a/src/java/org/apache/poi/hssf/record/SupBookRecord.java +++ b/src/java/org/apache/poi/hssf/record/SupBookRecord.java @@ -66,17 +66,6 @@ public final class SupBookRecord extends Record { _isAddInFunctions = false; } - /** - * Constructs a Extern Sheet record and sets its fields appropriately. - * - * @param id id must be 0x16 or an exception will be throw upon validation - * @param size the size of the data area of the record - * @param data data of the record (should not contain sid/len) - */ - public SupBookRecord(RecordInputStream in) { - super(in); - } - public boolean isExternalReferences() { return field_3_sheet_names != null; } @@ -94,7 +83,7 @@ public final class SupBookRecord extends Record { * @param size size of data * @param offset of the record's data (provided a big array of the file) */ - protected void fillFields(RecordInputStream in) { + public SupBookRecord(RecordInputStream in) { field_1_number_of_sheets = in.readShort(); if(in.getLength() > SMALL_RECORD_SIZE) { diff --git a/src/java/org/apache/poi/hssf/record/TabIdRecord.java b/src/java/org/apache/poi/hssf/record/TabIdRecord.java index 5e292c45f6..d5aca3e045 100644 --- a/src/java/org/apache/poi/hssf/record/TabIdRecord.java +++ b/src/java/org/apache/poi/hssf/record/TabIdRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; @@ -29,10 +27,7 @@ import org.apache.poi.util.LittleEndian; * @author Andrew C. Oliver (acoliver at apache dot org) * @version 2.0-pre */ - -public class TabIdRecord - extends Record -{ +public final class TabIdRecord extends Record { public final static short sid = 0x13d; public short[] field_1_tabids; @@ -40,17 +35,7 @@ public class TabIdRecord { } - /** - * Constructs a TabID record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public TabIdRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_tabids = new short[ in.remaining() / 2 ]; for (int k = 0; k < field_1_tabids.length; k++) @@ -97,13 +82,12 @@ public class TabIdRecord public int serialize(int offset, byte [] data) { - short[] tabids = getTabIdArray(); - short length = ( short ) (tabids.length * 2); - int byteoffset = 4; + short[] tabids = getTabIdArray(); + int length = tabids.length * 2; + int byteoffset = 4; - LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, - (( short ) length)); // nubmer tabids * + LittleEndian.putUShort(data, 0 + offset, sid); + LittleEndian.putUShort(data, 2 + offset, length); // nubmer tabids * // 2 (num bytes in a short) for (int k = 0; k < (length / 2); k++) diff --git a/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java b/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java index e8df518c97..8a27d163da 100644 --- a/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java +++ b/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java @@ -69,19 +69,7 @@ public class TextObjectBaseRecord extends Record { } - /** - * Constructs a TextObjectBase record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public TextObjectBaseRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_options = in.readShort(); field_2_textOrientation = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/TextObjectRecord.java b/src/java/org/apache/poi/hssf/record/TextObjectRecord.java index 5201a7292b..600aaf1542 100644 --- a/src/java/org/apache/poi/hssf/record/TextObjectRecord.java +++ b/src/java/org/apache/poi/hssf/record/TextObjectRecord.java @@ -17,11 +17,11 @@ package org.apache.poi.hssf.record; +import java.io.UnsupportedEncodingException; + import org.apache.poi.hssf.usermodel.HSSFRichTextString; -import org.apache.poi.util.LittleEndian; import org.apache.poi.util.HexDump; -import java.io.UnsupportedEncodingException; -import java.io.ByteArrayOutputStream; +import org.apache.poi.util.LittleEndian; public class TextObjectRecord extends TextObjectBaseRecord @@ -35,13 +35,7 @@ public class TextObjectRecord public TextObjectRecord( RecordInputStream in ) { super( in ); - if (str == null) - str = new HSSFRichTextString(""); - } - protected void fillFields(RecordInputStream in) - { - super.fillFields(in); if (getTextLength() > 0) { if (in.isContinueNext() && in.remaining() == 0) { //1st Continue @@ -56,6 +50,8 @@ public class TextObjectRecord processFontRuns(in); } else throw new RecordFormatException("Expected Continue Record to hold font runs for TextObjectRecord"); } + if (str == null) + str = new HSSFRichTextString(""); } diff --git a/src/java/org/apache/poi/hssf/record/TextRecord.java b/src/java/org/apache/poi/hssf/record/TextRecord.java index 7ef94f27a9..60c05e6d0a 100644 --- a/src/java/org/apache/poi/hssf/record/TextRecord.java +++ b/src/java/org/apache/poi/hssf/record/TextRecord.java @@ -93,19 +93,7 @@ public final class TextRecord extends Record { } - /** - * Constructs a Text record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public TextRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_horizontalAlignment = in.readByte(); field_2_verticalAlignment = in.readByte(); diff --git a/src/java/org/apache/poi/hssf/record/TickRecord.java b/src/java/org/apache/poi/hssf/record/TickRecord.java index e3230d1dca..7e216156c6 100644 --- a/src/java/org/apache/poi/hssf/record/TickRecord.java +++ b/src/java/org/apache/poi/hssf/record/TickRecord.java @@ -56,19 +56,7 @@ public final class TickRecord extends Record { } - /** - * Constructs a Tick record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public TickRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_majorTickType = in.readByte(); diff --git a/src/java/org/apache/poi/hssf/record/TopMarginRecord.java b/src/java/org/apache/poi/hssf/record/TopMarginRecord.java index 78860616ef..d67509e6c6 100644 --- a/src/java/org/apache/poi/hssf/record/TopMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/TopMarginRecord.java @@ -33,17 +33,9 @@ public class TopMarginRecord extends Record implements Margin public TopMarginRecord() { } /** - * Constructs a TopMargin record and sets its fields appropriately. - * * @param in the RecordInputstream to read the record from */ public TopMarginRecord( RecordInputStream in ) - { super( in ); } - - /** - * @param in the RecordInputstream to read the record from - */ - protected void fillFields( RecordInputStream in ) { field_1_margin = in.readDouble(); } @@ -89,4 +81,4 @@ public class TopMarginRecord extends Record implements Margin rec.field_1_margin = this.field_1_margin; return rec; } -} // END OF CLASS \ No newline at end of file +} // END OF CLAS \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/UncalcedRecord.java b/src/java/org/apache/poi/hssf/record/UncalcedRecord.java index c4ca369f6b..adc2cdeb90 100644 --- a/src/java/org/apache/poi/hssf/record/UncalcedRecord.java +++ b/src/java/org/apache/poi/hssf/record/UncalcedRecord.java @@ -37,19 +37,13 @@ public class UncalcedRecord extends Record */ public UncalcedRecord() { } - /** - * read constructor - */ - public UncalcedRecord(RecordInputStream in) { - super(in); - } public short getSid() { return sid; } - protected void fillFields(RecordInputStream in) { - short unused = in.readShort(); + public UncalcedRecord(RecordInputStream in) { + in.readShort(); // unused } public String toString() { @@ -60,9 +54,9 @@ public class UncalcedRecord extends Record } public int serialize(int offset, byte[] data) { - LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, (short) 2); - LittleEndian.putShort(data, 4 + offset, (short) 0); // unused + LittleEndian.putUShort(data, 0 + offset, sid); + LittleEndian.putUShort(data, 2 + offset, 2); + LittleEndian.putUShort(data, 4 + offset, 0); // unused return getRecordSize(); } diff --git a/src/java/org/apache/poi/hssf/record/UnicodeString.java b/src/java/org/apache/poi/hssf/record/UnicodeString.java index 3cf35accd1..4258d0a6d5 100644 --- a/src/java/org/apache/poi/hssf/record/UnicodeString.java +++ b/src/java/org/apache/poi/hssf/record/UnicodeString.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; @@ -225,9 +223,7 @@ public class UnicodeString throw new RecordFormatException("Expected continue record."); } if (isCompressed) { - //Typecast direct to char from byte with high bit set causes all ones - //in the high byte of the char (which is of course incorrect) - char ch = (char)( (short)0xff & (short)in.readByte() ); + char ch = (char)in.readUByte(); // avoid sex tmpString.append(ch); } else { char ch = (char) in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/UnitsRecord.java b/src/java/org/apache/poi/hssf/record/UnitsRecord.java index 84464376f8..4295cfe79b 100644 --- a/src/java/org/apache/poi/hssf/record/UnitsRecord.java +++ b/src/java/org/apache/poi/hssf/record/UnitsRecord.java @@ -42,18 +42,7 @@ public class UnitsRecord } - /** - * Constructs a Units record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ public UnitsRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_units = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/UnknownRecord.java b/src/java/org/apache/poi/hssf/record/UnknownRecord.java index 6f78f6ff5b..77de66d9b3 100644 --- a/src/java/org/apache/poi/hssf/record/UnknownRecord.java +++ b/src/java/org/apache/poi/hssf/record/UnknownRecord.java @@ -269,11 +269,6 @@ public final class UnknownRecord extends Record { return false; } - protected final void fillFields(RecordInputStream in) { - throw new RecordFormatException( - "Unknown record cannot be constructed via offset -- we need a copy of the data"); - } - public final Object clone() { // immutable - ok to return this return this; diff --git a/src/java/org/apache/poi/hssf/record/UseSelFSRecord.java b/src/java/org/apache/poi/hssf/record/UseSelFSRecord.java index 9b2e25e527..8e64ef3d4a 100644 --- a/src/java/org/apache/poi/hssf/record/UseSelFSRecord.java +++ b/src/java/org/apache/poi/hssf/record/UseSelFSRecord.java @@ -42,17 +42,7 @@ public class UseSelFSRecord { } - /** - * Constructs a UseSelFS record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public UseSelFSRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_flag = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/VCenterRecord.java b/src/java/org/apache/poi/hssf/record/VCenterRecord.java index 5df785caa3..7326a32929 100644 --- a/src/java/org/apache/poi/hssf/record/VCenterRecord.java +++ b/src/java/org/apache/poi/hssf/record/VCenterRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; @@ -30,27 +28,15 @@ import org.apache.poi.util.LittleEndian; * @version 2.0-pre */ -public class VCenterRecord - extends Record -{ +public final class VCenterRecord extends Record { public final static short sid = 0x84; - private short field_1_vcenter; + private int field_1_vcenter; public VCenterRecord() { } - /** - * Constructs a VCENTER record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public VCenterRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_vcenter = in.readShort(); } @@ -62,14 +48,7 @@ public class VCenterRecord public void setVCenter(boolean hc) { - if (hc == true) - { - field_1_vcenter = 1; - } - else - { - field_1_vcenter = 0; - } + field_1_vcenter = hc ? 1 : 0; } /** @@ -95,9 +74,9 @@ public class VCenterRecord public int serialize(int offset, byte [] data) { - LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, ( short ) 0x2); - LittleEndian.putShort(data, 4 + offset, ( short ) field_1_vcenter); + LittleEndian.putUShort(data, 0 + offset, sid); + LittleEndian.putUShort(data, 2 + offset, 0x2); + LittleEndian.putUShort(data, 4 + offset, field_1_vcenter); return getRecordSize(); } diff --git a/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java b/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java index c7c07cfe65..bc5023212c 100644 --- a/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java +++ b/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java @@ -55,19 +55,7 @@ public final class ValueRangeRecord extends Record { } - /** - * Constructs a ValueRange record and sets its fields appropriately. - * - * @param in the RecordInputstream to read the record from - */ - public ValueRangeRecord(RecordInputStream in) - { - super(in); - - } - - protected void fillFields(RecordInputStream in) { field_1_minimumAxisValue = in.readDouble(); field_2_maximumAxisValue = in.readDouble(); diff --git a/src/java/org/apache/poi/hssf/record/WSBoolRecord.java b/src/java/org/apache/poi/hssf/record/WSBoolRecord.java index 9a4f3dd209..bdb1cb4847 100644 --- a/src/java/org/apache/poi/hssf/record/WSBoolRecord.java +++ b/src/java/org/apache/poi/hssf/record/WSBoolRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; @@ -33,55 +31,33 @@ import org.apache.poi.util.LittleEndian; * @author Jason Height (jheight at chariot dot net dot au) * @version 2.0-pre */ - -public class WSBoolRecord - extends Record -{ +public final class WSBoolRecord extends Record { public final static short sid = 0x81; private byte field_1_wsbool; // crappy names are because this is really one big short field (2byte) - private byte field_2_wsbool; // but the docs inconsistantly use it as 2 seperate bytes + private byte field_2_wsbool; // but the docs inconsistently use it as 2 separate bytes - // I decided to be consistant in this way. - static final private BitField autobreaks = - BitFieldFactory.getInstance(0x01); // are automatic page breaks visible + // I decided to be consistent in this way. + private static final BitField autobreaks = BitFieldFactory.getInstance(0x01); // are automatic page breaks visible // bits 1 to 3 unused - static final private BitField dialog = - BitFieldFactory.getInstance(0x10); // is sheet dialog sheet - static final private BitField applystyles = - BitFieldFactory.getInstance(0x20); // whether to apply automatic styles to outlines - static final private BitField rowsumsbelow = BitFieldFactory.getInstance( - 0x40); // whether summary rows will appear below detail in outlines - static final private BitField rowsumsright = BitFieldFactory.getInstance( - 0x80); // whether summary rows will appear right of the detail in outlines - static final private BitField fittopage = - BitFieldFactory.getInstance(0x01); // whether to fit stuff to the page + private static final BitField dialog = BitFieldFactory.getInstance(0x10); // is sheet dialog sheet + private static final BitField applystyles = BitFieldFactory.getInstance(0x20); // whether to apply automatic styles to outlines + private static final BitField rowsumsbelow = BitFieldFactory.getInstance(0x40); // whether summary rows will appear below detail in outlines + private static final BitField rowsumsright = BitFieldFactory.getInstance(0x80); // whether summary rows will appear right of the detail in outlines + private static final BitField fittopage = BitFieldFactory.getInstance(0x01); // whether to fit stuff to the page // bit 2 reserved - static final private BitField displayguts = BitFieldFactory.getInstance( - 0x06); // whether to display outline symbols (in the gutters) + private static final BitField displayguts = BitFieldFactory.getInstance(0x06); // whether to display outline symbols (in the gutters) // bits 4-5 reserved - static final private BitField alternateexpression = // whether to use alternate expression eval - BitFieldFactory.getInstance(0x40); - static final private BitField alternateformula = // whether to use alternate formula entry - BitFieldFactory.getInstance(0x80); + private static final BitField alternateexpression = BitFieldFactory.getInstance(0x40); // whether to use alternate expression eval + private static final BitField alternateformula = BitFieldFactory.getInstance(0x80); // whether to use alternate formula entry public WSBoolRecord() { } - /** - * Constructs a WSBool record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public WSBoolRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { byte data[] = in.readRemainder(); field_1_wsbool = diff --git a/src/java/org/apache/poi/hssf/record/WindowOneRecord.java b/src/java/org/apache/poi/hssf/record/WindowOneRecord.java index 91f9cbd647..7afc5fa1f8 100644 --- a/src/java/org/apache/poi/hssf/record/WindowOneRecord.java +++ b/src/java/org/apache/poi/hssf/record/WindowOneRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; @@ -32,10 +30,7 @@ import org.apache.poi.util.LittleEndian; * @author Andrew C. Oliver (acoliver at apache dot org) * @version 2.0-pre */ - -public class WindowOneRecord - extends Record -{ +public final class WindowOneRecord extends Record { public final static short sid = 0x3d; // our variable names stolen from old TV sets. @@ -66,17 +61,7 @@ public class WindowOneRecord { } - /** - * Constructs a WindowOne record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public WindowOneRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_h_hold = in.readShort(); field_2_v_hold = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/WindowProtectRecord.java b/src/java/org/apache/poi/hssf/record/WindowProtectRecord.java index 7f7b423363..13d54e9b5e 100644 --- a/src/java/org/apache/poi/hssf/record/WindowProtectRecord.java +++ b/src/java/org/apache/poi/hssf/record/WindowProtectRecord.java @@ -39,17 +39,7 @@ public class WindowProtectRecord { } - /** - * Constructs a WindowProtect record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public WindowProtectRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { field_1_protect = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java b/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java index 012a9e22ee..9023d2d692 100644 --- a/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java +++ b/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java @@ -61,17 +61,7 @@ public final class WindowTwoRecord extends Record { { } - /** - * Constructs a WindowTwo record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public WindowTwoRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { int size = in.remaining(); field_1_options = in.readShort(); diff --git a/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java b/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java index a01953a501..d73687f186 100644 --- a/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java +++ b/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java @@ -42,17 +42,7 @@ public class WriteAccessRecord { } - /** - * Constructs a WriteAccess record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public WriteAccessRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { byte[] data = in.readRemainder(); //The string is always 112 characters (padded with spaces), therefore diff --git a/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java b/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java index 5cef19d616..eb27e0ec12 100644 --- a/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java +++ b/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,12 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.StringUtil; /** * Title: Write Protect Record

@@ -28,10 +25,7 @@ import org.apache.poi.util.StringUtil; * REFERENCE: PG 425 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)

* @version 3.0-pre */ - -public class WriteProtectRecord - extends Record -{ +public final class WriteProtectRecord extends Record { public final static short sid = 0x86; public WriteProtectRecord() @@ -39,16 +33,9 @@ public class WriteProtectRecord } /** - * Constructs a WriteAccess record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from + * @param in unused (since this record has no data) */ - public WriteProtectRecord(RecordInputStream in) - { - super(in); - } - - protected void fillFields(RecordInputStream in) { } @@ -63,8 +50,8 @@ public class WriteProtectRecord public int serialize(int offset, byte [] data) { - LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, (short)0); + LittleEndian.putUShort(data, 0 + offset, sid); + LittleEndian.putUShort(data, 2 + offset, 0); return getRecordSize(); } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java index 6fb08f4ee3..4357c57e3b 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java @@ -498,18 +498,12 @@ public final class TestHSSFWorkbook extends TestCase { public BadlyBehavedRecord() { // } - protected void fillFields(RecordInputStream in) { - throw new RuntimeException("Should not be called"); - } public short getSid() { return 0x777; } public int serialize(int offset, byte[] data) { return 4; } - protected void validateSid(short id) { - throw new RuntimeException("Should not be called"); - } public int getRecordSize() { return 8; }