poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r718681 [1/2] - /poi/trunk/src/java/org/apache/poi/hssf/record/
Date Tue, 18 Nov 2008 18:49:21 GMT
Author: josh
Date: Tue Nov 18 10:49:19 2008
New Revision: 718681

URL: http://svn.apache.org/viewvc?rev=718681&view=rev
Log:
Refactoring Record.serialize methods

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/AreaRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/AxisParentRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/AxisRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/BOFRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/BackupRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/BarRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/BeginRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/BlankRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/BookBoolRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/BoolErrRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/CRNCountRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/CalcCountRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/CalcModeRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ChartRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/CodepageRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/CountryRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/DSFRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/DatRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/DataFormatRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/DateWindow1904Record.java
    poi/trunk/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/DeltaRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/DimensionsRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/EOFRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/EndRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/FilePassRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/FnGroupCountRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/FontBasisRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/FontIndexRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/FrameRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/GridsetRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/GutsRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/HCenterRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/HideObjRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/IterationRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/LegendRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/LineFormatRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/MMSRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/NumberRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/PaneRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/PasswordRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/PasswordRev4Record.java
    poi/trunk/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/PrecisionRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/PrintSetupRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ProtectRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ProtectionRev4Record.java
    poi/trunk/src/java/org/apache/poi/hssf/record/RefModeRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/RefreshAllRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/RightMarginRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/RowRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/SCLRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ScenarioProtectRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/SeriesRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/TextRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/TickRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/TopMarginRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/UncalcedRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/UnitsRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/UseSelFSRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/VCenterRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/WSBoolRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/WindowOneRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/WindowProtectRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java Tue Nov 18 10:49:19 2008
@@ -20,14 +20,14 @@
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The area format record is used to define the colours and patterns for an area.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class AreaFormatRecord extends Record {
+public final class AreaFormatRecord extends StandardRecord {
     public final static short sid = 0x100A;
     
     private static final BitField automatic = BitFieldFactory.getInstance(0x1);
@@ -93,21 +93,13 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putInt(data, 4 + offset + pos, field_1_foregroundColor);
-        LittleEndian.putInt(data, 8 + offset + pos, field_2_backgroundColor);
-        LittleEndian.putShort(data, 12 + offset + pos, field_3_pattern);
-        LittleEndian.putShort(data, 14 + offset + pos, field_4_formatFlags);
-        LittleEndian.putShort(data, 16 + offset + pos, field_5_forecolorIndex);
-        LittleEndian.putShort(data, 18 + offset + pos, field_6_backcolorIndex);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeInt(field_1_foregroundColor);
+        out.writeInt(field_2_backgroundColor);
+        out.writeShort(field_3_pattern);
+        out.writeShort(field_4_formatFlags);
+        out.writeShort(field_5_forecolorIndex);
+        out.writeShort(field_6_backcolorIndex);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/AreaRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/AreaRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/AreaRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/AreaRecord.java Tue Nov 18 10:49:19 2008
@@ -20,14 +20,14 @@
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The area record is used to define a area chart.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class AreaRecord extends Record {
+public final class AreaRecord extends StandardRecord {
     public final static short      sid                             = 0x101A;
     private  short      field_1_formatFlags;
     private static final BitField stacked             = BitFieldFactory.getInstance(0x1);
@@ -63,16 +63,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_formatFlags);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_formatFlags);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java Tue Nov 18 10:49:19 2008
@@ -18,14 +18,14 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The axis line format record defines the axis type details.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class AxisLineFormatRecord extends Record {
+public final class AxisLineFormatRecord extends StandardRecord {
     public final static short      sid                             = 0x1021;
     private  short      field_1_axisType;
     public final static short       AXIS_TYPE_AXIS_LINE            = 0;
@@ -58,16 +58,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_axisType);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_axisType);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java Tue Nov 18 10:49:19 2008
@@ -20,14 +20,14 @@
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The axis options record provides unit information and other various tidbits about the axis.<p/>
  * 
  * @author Andrew C. Oliver(acoliver at apache.org)
  */
-public final class AxisOptionsRecord extends Record {
+public final class AxisOptionsRecord extends StandardRecord {
     public final static short sid = 0x1062;
 
     private static final BitField defaultMinimum      = BitFieldFactory.getInstance(0x01);
@@ -122,24 +122,16 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_minimumCategory);
-        LittleEndian.putShort(data, 6 + offset + pos, field_2_maximumCategory);
-        LittleEndian.putShort(data, 8 + offset + pos, field_3_majorUnitValue);
-        LittleEndian.putShort(data, 10 + offset + pos, field_4_majorUnit);
-        LittleEndian.putShort(data, 12 + offset + pos, field_5_minorUnitValue);
-        LittleEndian.putShort(data, 14 + offset + pos, field_6_minorUnit);
-        LittleEndian.putShort(data, 16 + offset + pos, field_7_baseUnit);
-        LittleEndian.putShort(data, 18 + offset + pos, field_8_crossingPoint);
-        LittleEndian.putShort(data, 20 + offset + pos, field_9_options);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_minimumCategory);
+        out.writeShort(field_2_maximumCategory);
+        out.writeShort(field_3_majorUnitValue);
+        out.writeShort(field_4_majorUnit);
+        out.writeShort(field_5_minorUnitValue);
+        out.writeShort(field_6_minorUnit);
+        out.writeShort(field_7_baseUnit);
+        out.writeShort(field_8_crossingPoint);
+        out.writeShort(field_9_options);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/AxisParentRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/AxisParentRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/AxisParentRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/AxisParentRecord.java Tue Nov 18 10:49:19 2008
@@ -18,14 +18,14 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The axis size and location<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class AxisParentRecord extends Record {
+public final class AxisParentRecord extends StandardRecord {
     public final static short      sid                             = 0x1041;
     private  short      field_1_axisType;
     public final static short       AXIS_TYPE_MAIN                 = 0;
@@ -80,20 +80,12 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_axisType);
-        LittleEndian.putInt(data, 6 + offset + pos, field_2_x);
-        LittleEndian.putInt(data, 10 + offset + pos, field_3_y);
-        LittleEndian.putInt(data, 14 + offset + pos, field_4_width);
-        LittleEndian.putInt(data, 18 + offset + pos, field_5_height);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_axisType);
+        out.writeInt(field_2_x);
+        out.writeInt(field_3_y);
+        out.writeInt(field_4_width);
+        out.writeInt(field_5_height);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/AxisRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/AxisRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/AxisRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/AxisRecord.java Tue Nov 18 10:49:19 2008
@@ -18,14 +18,14 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The axis record defines the type of an axis.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class AxisRecord extends Record {
+public final class AxisRecord extends StandardRecord {
     public final static short      sid                             = 0x101d;
     private  short      field_1_axisType;
     public final static short       AXIS_TYPE_CATEGORY_OR_X_AXIS   = 0;
@@ -81,20 +81,12 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_axisType);
-        LittleEndian.putInt(data, 6 + offset + pos, field_2_reserved1);
-        LittleEndian.putInt(data, 10 + offset + pos, field_3_reserved2);
-        LittleEndian.putInt(data, 14 + offset + pos, field_4_reserved3);
-        LittleEndian.putInt(data, 18 + offset + pos, field_5_reserved4);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_axisType);
+        out.writeInt(field_2_reserved1);
+        out.writeInt(field_3_reserved2);
+        out.writeInt(field_4_reserved3);
+        out.writeInt(field_5_reserved4);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java Tue Nov 18 10:49:19 2008
@@ -18,14 +18,14 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The number of axes used on a chart.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class AxisUsedRecord extends Record {
+public final class AxisUsedRecord extends StandardRecord {
     public final static short      sid                             = 0x1046;
     private  short      field_1_numAxis;
 
@@ -54,16 +54,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_numAxis);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_numAxis);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/BOFRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/BOFRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/BOFRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/BOFRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title: Beginning Of File<P>
@@ -32,8 +32,8 @@
  * @version 2.0-pre
  */
 
-public class BOFRecord
-    extends Record
+public final class BOFRecord
+    extends StandardRecord
 {
 
     /**
@@ -272,18 +272,13 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x10));   // 16 byte length
-        LittleEndian.putShort(data, 4 + offset, getVersion());
-        LittleEndian.putShort(data, 6 + offset, getType());
-        LittleEndian.putShort(data, 8 + offset, getBuild());
-        LittleEndian.putShort(data, 10 + offset, getBuildYear());
-        LittleEndian.putInt(data, 12 + offset, getHistoryBitMask());
-        LittleEndian.putInt(data, 16 + offset, getRequiredVersion());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getVersion());
+        out.writeShort(getType());
+        out.writeShort(getBuild());
+        out.writeShort(getBuildYear());
+        out.writeInt(getHistoryBitMask());
+        out.writeInt(getRequiredVersion());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/BackupRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/BackupRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/BackupRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/BackupRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Backup Record <P>
@@ -30,8 +30,8 @@
  * @version 2.0-pre
  */
 
-public class BackupRecord
-    extends Record
+public final class BackupRecord
+    extends StandardRecord
 {
     public final static short sid = 0x40;
     private short             field_1_backup;   // = 0;
@@ -78,13 +78,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x02));   // 2 bytes (6 total)
-        LittleEndian.putShort(data, 4 + offset, getBackup());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getBackup());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/BarRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/BarRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/BarRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/BarRecord.java Tue Nov 18 10:49:19 2008
@@ -20,14 +20,14 @@
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The bar record is used to define a bar chart.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class BarRecord extends Record {
+public final class BarRecord extends StandardRecord {
     public final static short sid = 0x1017;
 
     private static final BitField   horizontal          = BitFieldFactory.getInstance(0x1);
@@ -78,18 +78,10 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_barSpace);
-        LittleEndian.putShort(data, 6 + offset + pos, field_2_categorySpace);
-        LittleEndian.putShort(data, 8 + offset + pos, field_3_formatFlags);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_barSpace);
+        out.writeShort(field_2_categorySpace);
+        out.writeShort(field_3_formatFlags);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/BeginRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/BeginRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/BeginRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/BeginRecord.java Tue Nov 18 10:49:19 2008
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The begin record defines the start of a block of records for a (grpahing
@@ -27,7 +27,7 @@
  *
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public class BeginRecord extends Record {
+public final class BeginRecord extends StandardRecord {
     public static final short sid = 0x1033;
 
     public BeginRecord()
@@ -50,11 +50,7 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putUShort(data, 0 + offset, sid);
-        LittleEndian.putUShort(data, 2 + offset, 0);   // no record info
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/BlankRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/BlankRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/BlankRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/BlankRecord.java Tue Nov 18 10:49:19 2008
@@ -18,7 +18,7 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Blank cell record (0x0201) <P>
@@ -28,7 +28,7 @@
  * @author Jason Height (jheight at chariot dot net dot au)
  * @version 2.0-pre
  */
-public final class BlankRecord extends Record implements CellValueRecordInterface {
+public final class BlankRecord extends StandardRecord implements CellValueRecordInterface {
     public final static short sid = 0x0201;
     private int             field_1_row;
     private short             field_2_col;
@@ -127,21 +127,10 @@
         return sb.toString();
     }
 
-    /**
-     * called by the class that is responsible for writing this sucker.
-     * Subclasses should implement this so that their data is passed back in a
-     * byte array.
-     *
-     * @return byte array containing instance data
-     */
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putUShort(data, 0 + offset, sid);
-        LittleEndian.putUShort(data, 2 + offset, 6);
-        LittleEndian.putUShort(data, 4 + offset, getRow());
-        LittleEndian.putUShort(data, 6 + offset, getColumn());
-        LittleEndian.putUShort(data, 8 + offset, getXFIndex());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getRow());
+        out.writeShort(getColumn());
+        out.writeShort(getXFIndex());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/BookBoolRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/BookBoolRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/BookBoolRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/BookBoolRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Save External Links record (BookBool)<P>
@@ -30,8 +30,8 @@
  * @version 2.0-pre
  */
 
-public class BookBoolRecord
-    extends Record
+public final class BookBoolRecord
+    extends StandardRecord
 {
     public final static short sid = 0xDA;
     private short             field_1_save_link_values;
@@ -78,13 +78,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x02));   // 2 bytes (6 total)
-        LittleEndian.putShort(data, 4 + offset, field_1_save_link_values);
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_save_link_values);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/BoolErrRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/BoolErrRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/BoolErrRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/BoolErrRecord.java Tue Nov 18 10:49:19 2008
@@ -18,7 +18,7 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Creates new BoolErrRecord. (0x0205) <P>
@@ -27,7 +27,7 @@
  * @author Jason Height (jheight at chariot dot net dot au)
  * @version 2.0-pre
  */
-public final class BoolErrRecord extends Record implements CellValueRecordInterface {
+public final class BoolErrRecord extends StandardRecord implements CellValueRecordInterface {
     public final static short sid = 0x0205;
     private int               field_1_row;
     private short             field_2_column;
@@ -187,23 +187,12 @@
         return sb.toString();
     }
 
-    /**
-     * called by the class that is responsible for writing this sucker.
-     * Subclasses should implement this so that their data is passed back in a
-     * byte array.
-     * 
-     * @return byte array containing instance data
-     */
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putUShort(data, 0 + offset, sid);
-        LittleEndian.putUShort(data, 2 + offset, 8);
-        LittleEndian.putUShort(data, 4 + offset, getRow());
-        LittleEndian.putUShort(data, 6 + offset, getColumn());
-        LittleEndian.putUShort(data, 8 + offset, getXFIndex());
-        data[ 10 + offset ] = field_4_bBoolErr;
-        data[ 11 + offset ] = field_5_fError;
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getRow());
+        out.writeShort(getColumn());
+        out.writeShort(getXFIndex());
+        out.writeByte(field_4_bBoolErr);
+        out.writeByte(field_5_fError);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java Tue Nov 18 10:49:19 2008
@@ -27,7 +27,7 @@
  * 
  * @author Shawn Laubach (slaubach at apache dot org)
  */
-public final class BottomMarginRecord extends Record implements Margin {
+public final class BottomMarginRecord extends StandardRecord implements Margin {
     public final static short sid = 0x29;
     private double field_1_margin;
 
@@ -51,12 +51,8 @@
         return buffer.toString();
     }
 
-    public int serialize( int offset, byte[] data )
-    {
-        LittleEndian.putShort( data, 0 + offset, sid );
-        LittleEndian.putShort( data, 2 + offset, (short) ( getRecordSize() - 4 ) );
-        LittleEndian.putDouble( data, 4 + offset, field_1_margin );
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeDouble(field_1_margin);
     }
 
     protected int getDataSize() {
@@ -91,4 +87,4 @@
         return rec;
     }
 
-}  // END OF C
\ No newline at end of file
+}  // END OF 
\ No newline at end of file

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/CRNCountRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/CRNCountRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/CRNCountRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/CRNCountRecord.java Tue Nov 18 10:49:19 2008
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 /**
  * XCT - CRN Count <P>
  *
@@ -25,7 +25,7 @@
  *
  * @author Josh Micich
  */
-public final class CRNCountRecord extends Record {
+public final class CRNCountRecord extends StandardRecord {
 	public final static short sid = 0x59;
 
 	private static final short DATA_SIZE = 4;
@@ -63,12 +63,9 @@
         return sb.toString();
 	}
 
-	public int serialize(int offset, byte [] data) {
-		LittleEndian.putShort(data, 0 + offset, sid);
-		LittleEndian.putShort(data, 2 + offset, DATA_SIZE);
-		LittleEndian.putShort(data, 4 + offset, (short)field_1_number_crn_records);
-		LittleEndian.putShort(data, 6 + offset, (short)field_2_sheet_table_index);
-		return getRecordSize();
+	public void serialize(LittleEndianOutput out) {
+		out.writeShort((short)field_1_number_crn_records);
+		out.writeShort((short)field_2_sheet_table_index);
 	}
 	protected int getDataSize() {
 		return DATA_SIZE;

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/CalcCountRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/CalcCountRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/CalcCountRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/CalcCountRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Calc Count Record
@@ -35,8 +35,8 @@
  * @see org.apache.poi.hssf.record.CalcModeRecord
  */
 
-public class CalcCountRecord
-    extends Record
+public final class CalcCountRecord
+    extends StandardRecord
 {
     public final static short sid = 0xC;
     private short             field_1_iterations;
@@ -81,12 +81,8 @@
         return buffer.toString();
     }
 
-    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, getIterations());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getIterations());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/CalcModeRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/CalcModeRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/CalcModeRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/CalcModeRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Calc Mode Record<P>
@@ -33,8 +33,8 @@
  * @see org.apache.poi.hssf.record.CalcCountRecord
  */
 
-public class CalcModeRecord
-    extends Record
+public final class CalcModeRecord
+    extends StandardRecord
 {
     public final static short sid                     = 0xD;
 
@@ -107,12 +107,8 @@
         return buffer.toString();
     }
 
-    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, getCalcMode());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getCalcMode());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java Tue Nov 18 10:49:19 2008
@@ -20,14 +20,14 @@
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * This record refers to a category or series axis and is used to specify label/tickmark frequency.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class CategorySeriesAxisRecord extends Record {
+public final class CategorySeriesAxisRecord extends StandardRecord {
     public final static short sid = 0x1020;
 
     private static final BitField valueAxisCrossing = BitFieldFactory.getInstance(0x1);
@@ -82,19 +82,11 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_crossingPoint);
-        LittleEndian.putShort(data, 6 + offset + pos, field_2_labelFrequency);
-        LittleEndian.putShort(data, 8 + offset + pos, field_3_tickMarkFrequency);
-        LittleEndian.putShort(data, 10 + offset + pos, field_4_options);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_crossingPoint);
+        out.writeShort(field_2_labelFrequency);
+        out.writeShort(field_3_tickMarkFrequency);
+        out.writeShort(field_4_options);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Class ChartFormatRecord
@@ -28,7 +28,7 @@
  * @author Glen Stampoultzis (glens at apache.org)
  * @version %I%, %G%
  */
-public final class ChartFormatRecord extends Record {
+public final class ChartFormatRecord extends StandardRecord {
     public static final short sid = 0x1014;
 
     private static final BitField varyDisplayPattern = BitFieldFactory.getInstance(0x01);
@@ -72,17 +72,12 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 22));   // 22 byte length
-        LittleEndian.putInt(data, 4 + offset, getXPosition());
-        LittleEndian.putInt(data, 8 + offset, getYPosition());
-        LittleEndian.putInt(data, 12 + offset, getWidth());
-        LittleEndian.putInt(data, 16 + offset, getHeight());
-        LittleEndian.putShort(data, 20 + offset, field5_grbit);
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeInt(getXPosition());
+        out.writeInt(getYPosition());
+        out.writeInt(getWidth());
+        out.writeInt(getHeight());
+        out.writeShort(field5_grbit);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/ChartRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/ChartRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/ChartRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/ChartRecord.java Tue Nov 18 10:49:19 2008
@@ -18,13 +18,13 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The chart record is used to define the location and size of a chart.
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class ChartRecord extends Record {
+public final class ChartRecord extends StandardRecord {
     public final static short      sid                             = 0x1002;
     private  int        field_1_x;
     private  int        field_2_y;
@@ -71,19 +71,11 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putInt(data, 4 + offset + pos, field_1_x);
-        LittleEndian.putInt(data, 8 + offset + pos, field_2_y);
-        LittleEndian.putInt(data, 12 + offset + pos, field_3_width);
-        LittleEndian.putInt(data, 16 + offset + pos, field_4_height);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeInt(field_1_x);
+        out.writeInt(field_2_y);
+        out.writeInt(field_3_width);
+        out.writeInt(field_4_height);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/CodepageRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/CodepageRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/CodepageRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/CodepageRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title: Codepage Record<P>
@@ -29,8 +29,8 @@
  * @version 2.0-pre
  */
 
-public class CodepageRecord
-    extends Record
+public final class CodepageRecord
+    extends StandardRecord
 {
     public final static short sid = 0x42;
     private short             field_1_codepage;   // = 0;
@@ -87,13 +87,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x02));   // 2 bytes (6 total)
-        LittleEndian.putShort(data, 4 + offset, getCodepage());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getCodepage());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java Tue Nov 18 10:49:19 2008
@@ -18,7 +18,7 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 
@@ -29,7 +29,7 @@
  * @author Andrew C. Oliver (acoliver at apache dot org)
  * @version 2.0-pre
  */
-public final class ColumnInfoRecord extends Record {
+public final class ColumnInfoRecord extends StandardRecord {
     public static final short     sid = 0x7d;
     private int field_1_first_col;
     private int field_2_last_col;
@@ -267,17 +267,13 @@
         return sid;
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putUShort(data, 2 + offset, 12);
-        LittleEndian.putUShort(data, 4 + offset, getFirstColumn());
-        LittleEndian.putUShort(data, 6 + offset, getLastColumn());
-        LittleEndian.putUShort(data, 8 + offset, getColumnWidth());
-        LittleEndian.putUShort(data, 10 + offset, getXFIndex());
-        LittleEndian.putUShort(data, 12 + offset, field_5_options);
-        LittleEndian.putUShort(data, 14 + offset, field_6_reserved);   
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getFirstColumn());
+        out.writeShort(getLastColumn());
+        out.writeShort(getColumnWidth());
+        out.writeShort(getXFIndex());
+        out.writeShort(field_5_options);
+        out.writeShort(field_6_reserved);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/CountryRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/CountryRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/CountryRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/CountryRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Country Record (aka WIN.INI country)<P>
@@ -31,8 +31,8 @@
  * @version 2.0-pre
  */
 
-public class CountryRecord
-    extends Record
+public final class CountryRecord
+    extends StandardRecord
 {
     public final static short sid = 0x8c;
 
@@ -107,14 +107,9 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x04));   // 4 bytes (8 total)
-        LittleEndian.putShort(data, 4 + offset, getDefaultCountry());
-        LittleEndian.putShort(data, 6 + offset, getCurrentCountry());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getDefaultCountry());
+        out.writeShort(getCurrentCountry());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/DSFRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/DSFRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/DSFRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/DSFRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title: Double Stream Flag Record<P>
@@ -30,8 +30,8 @@
  * @version 2.0-pre
  */
 
-public class DSFRecord
-    extends Record
+public final class DSFRecord
+    extends StandardRecord
 {
     public final static short sid = 0x161;
     private short             field_1_dsf;
@@ -76,13 +76,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x02));   // 2 bytes (6 total)
-        LittleEndian.putShort(data, 4 + offset, getDsf());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getDsf());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/DatRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/DatRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/DatRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/DatRecord.java Tue Nov 18 10:49:19 2008
@@ -20,14 +20,14 @@
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The dat record is used to store options for the chart.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class DatRecord extends Record {
+public final class DatRecord extends StandardRecord {
     public final static short sid = 0x1063;
 
     private static final BitField horizontalBorder = BitFieldFactory.getInstance(0x1);
@@ -66,16 +66,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_options);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_options);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/DataFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/DataFormatRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/DataFormatRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/DataFormatRecord.java Tue Nov 18 10:49:19 2008
@@ -20,14 +20,14 @@
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The data format record is used to index into a series.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class DataFormatRecord extends Record {
+public final class DataFormatRecord extends StandardRecord {
     public final static short sid = 0x1006;
 
     private static final BitField useExcel4Colors = BitFieldFactory.getInstance(0x1);
@@ -78,19 +78,11 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_pointNumber);
-        LittleEndian.putShort(data, 6 + offset + pos, field_2_seriesIndex);
-        LittleEndian.putShort(data, 8 + offset + pos, field_3_seriesNumber);
-        LittleEndian.putShort(data, 10 + offset + pos, field_4_formatFlags);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_pointNumber);
+        out.writeShort(field_2_seriesIndex);
+        out.writeShort(field_3_seriesNumber);
+        out.writeShort(field_4_formatFlags);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/DateWindow1904Record.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/DateWindow1904Record.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/DateWindow1904Record.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/DateWindow1904Record.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Date Window 1904 Flag record <P>
@@ -30,8 +30,8 @@
  * @version 2.0-pre
  */
 
-public class DateWindow1904Record
-    extends Record
+public final class DateWindow1904Record
+    extends StandardRecord
 {
     public final static short sid = 0x22;
     private short             field_1_window;
@@ -76,13 +76,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x02));   // 2 bytes (6 total)
-        LittleEndian.putShort(data, 4 + offset, getWindowing());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getWindowing());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java Tue Nov 18 10:49:19 2008
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Default Column Width Record (0x0055) <P>
@@ -28,7 +28,7 @@
  * @author Jason Height (jheight at chariot dot net dot au)
  * @version 2.0-pre
  */
-public final class DefaultColWidthRecord extends Record {
+public final class DefaultColWidthRecord extends StandardRecord {
     public final static short sid = 0x0055;
     private int             field_1_col_width;
 
@@ -72,12 +72,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putUShort(data, 0 + offset, sid);
-        LittleEndian.putUShort(data, 2 + offset, 0x2);
-        LittleEndian.putUShort(data, 4 + offset, getColWidth());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getColWidth());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java Tue Nov 18 10:49:19 2008
@@ -18,14 +18,14 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The default data label text properties record identifies the text characteristics of the preceding text record.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class DefaultDataLabelTextPropertiesRecord extends Record {
+public final class DefaultDataLabelTextPropertiesRecord extends StandardRecord {
     public final static short      sid                             = 0x1024;
     private  short      field_1_categoryDataType;
     public final static short       CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC = 0;
@@ -57,16 +57,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_categoryDataType);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_categoryDataType);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Default Row Height Record
@@ -31,8 +31,8 @@
  * @version 2.0-pre
  */
 
-public class DefaultRowHeightRecord
-    extends Record
+public final class DefaultRowHeightRecord
+    extends StandardRecord
 {
     public final static short sid = 0x225;
     private short             field_1_option_flags;
@@ -101,13 +101,9 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, ( short ) 0x4);
-        LittleEndian.putShort(data, 4 + offset, getOptionFlags());
-        LittleEndian.putShort(data, 6 + offset, getRowHeight());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getOptionFlags());
+        out.writeShort(getRowHeight());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/DeltaRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/DeltaRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/DeltaRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/DeltaRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Delta Record<P>
@@ -30,8 +30,8 @@
  * @version 2.0-pre
  */
 
-public class DeltaRecord
-    extends Record
+public final class DeltaRecord
+    extends StandardRecord
 {
     public final static short  sid           = 0x10;
     public final static double DEFAULT_VALUE = 0.0010;   // should be .001
@@ -80,12 +80,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, ( short ) 0x8);
-        LittleEndian.putDouble(data, 4 + offset, getMaxChange());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeDouble(getMaxChange());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/DimensionsRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/DimensionsRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/DimensionsRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/DimensionsRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Dimensions Record<P>
@@ -31,8 +31,8 @@
  * @version 2.0-pre
  */
 
-public class DimensionsRecord
-    extends Record
+public final class DimensionsRecord
+    extends StandardRecord
 {
     public final static short sid = 0x200;
     private int               field_1_first_row;
@@ -153,16 +153,12 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, ( short ) 14);
-        LittleEndian.putInt(data, 4 + offset, getFirstRow());
-        LittleEndian.putInt(data, 8 + offset, getLastRow());
-        LittleEndian.putShort(data, 12 + offset, getFirstCol());
-        LittleEndian.putShort(data, 14 + offset, getLastCol());
-        LittleEndian.putShort(data, 16 + offset, ( short ) 0);
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeInt(getFirstRow());
+        out.writeInt(getLastRow());
+        out.writeShort(getFirstCol());
+        out.writeShort(getLastCol());
+        out.writeShort(( short ) 0);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/EOFRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/EOFRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/EOFRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/EOFRecord.java Tue Nov 18 10:49:19 2008
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * End Of File record.
@@ -29,7 +29,7 @@
  * @author Jason Height (jheight at chariot dot net dot au)
  * @version 2.0-pre
  */
-public final class EOFRecord extends Record {
+public final class EOFRecord extends StandardRecord {
     public final static short sid = 0x0A;
 	public static final int ENCODED_SIZE = 4;
 
@@ -55,12 +55,7 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0));   // no record info
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/EndRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/EndRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/EndRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/EndRecord.java Tue Nov 18 10:49:19 2008
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The end record defines the end of a block of records for a (Graphing)
@@ -28,7 +28,7 @@
  * @author Glen Stampoultzis (glens at apache.org)
  */
 
-public final class EndRecord extends Record {
+public final class EndRecord extends StandardRecord {
     public static final short sid = 0x1034;
 
     public EndRecord()
@@ -51,11 +51,7 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putUShort(data, 0 + offset, sid);
-        LittleEndian.putUShort(data, 2 + offset, 0);   // no record info
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java Tue Nov 18 10:49:19 2008
@@ -21,7 +21,7 @@
 
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Extended Format Record
@@ -39,8 +39,8 @@
  * @version 2.0-pre
  */
 
-public class ExtendedFormatRecord
-    extends Record
+public final class ExtendedFormatRecord
+    extends StandardRecord
 {
     public final static short     sid                 = 0xE0;
 
@@ -1770,21 +1770,16 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              ( short ) (20));   // 24 - 4(sid/len)
-        LittleEndian.putShort(data, 4 + offset, getFontIndex());
-        LittleEndian.putShort(data, 6 + offset, getFormatIndex());
-        LittleEndian.putShort(data, 8 + offset, getCellOptions());
-        LittleEndian.putShort(data, 10 + offset, getAlignmentOptions());
-        LittleEndian.putShort(data, 12 + offset, getIndentionOptions());
-        LittleEndian.putShort(data, 14 + offset, getBorderOptions());
-        LittleEndian.putShort(data, 16 + offset, getPaletteOptions());
-        LittleEndian.putInt(data, 18 + offset, getAdtlPaletteOptions());
-        LittleEndian.putShort(data, 22 + offset, getFillPaletteOptions());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getFontIndex());
+        out.writeShort(getFormatIndex());
+        out.writeShort(getCellOptions());
+        out.writeShort(getAlignmentOptions());
+        out.writeShort(getIndentionOptions());
+        out.writeShort(getBorderOptions());
+        out.writeShort(getPaletteOptions());
+        out.writeInt(getAdtlPaletteOptions());
+        out.writeShort(getFillPaletteOptions());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/FilePassRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/FilePassRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/FilePassRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/FilePassRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        File Pass Record<P>
@@ -30,8 +30,8 @@
  * @version 3.0-pre
  */
 
-public class FilePassRecord
-    extends Record
+public final class FilePassRecord
+    extends StandardRecord
 {
     public final static short sid = 0x2F;
     private int             field_1_encryptedpassword;
@@ -60,12 +60,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, ( short ) 0x4);
-        LittleEndian.putInt(data, 4 + offset, ( short ) field_1_encryptedpassword);
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeInt(( short ) field_1_encryptedpassword);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/FnGroupCountRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/FnGroupCountRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/FnGroupCountRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/FnGroupCountRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title: Function Group Count Record<P>
@@ -30,8 +30,8 @@
  * @version 2.0-pre
  */
 
-public class FnGroupCountRecord
-    extends Record
+public final class FnGroupCountRecord
+    extends StandardRecord
 {
     public final static short sid   = 0x9c;
 
@@ -84,13 +84,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x02));   // 2 bytes (6 total)
-        LittleEndian.putShort(data, 4 + offset, getCount());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getCount());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/FontBasisRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/FontBasisRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/FontBasisRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/FontBasisRecord.java Tue Nov 18 10:49:19 2008
@@ -18,14 +18,14 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The font basis record stores various font metrics.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class FontBasisRecord extends Record {
+public final class FontBasisRecord extends StandardRecord {
     public final static short      sid                             = 0x1060;
     private  short      field_1_xBasis;
     private  short      field_2_yBasis;
@@ -78,20 +78,12 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_xBasis);
-        LittleEndian.putShort(data, 6 + offset + pos, field_2_yBasis);
-        LittleEndian.putShort(data, 8 + offset + pos, field_3_heightBasis);
-        LittleEndian.putShort(data, 10 + offset + pos, field_4_scale);
-        LittleEndian.putShort(data, 12 + offset + pos, field_5_indexToFontTable);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_xBasis);
+        out.writeShort(field_2_yBasis);
+        out.writeShort(field_3_heightBasis);
+        out.writeShort(field_4_scale);
+        out.writeShort(field_5_indexToFontTable);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/FontIndexRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/FontIndexRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/FontIndexRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/FontIndexRecord.java Tue Nov 18 10:49:19 2008
@@ -18,14 +18,14 @@
 package org.apache.poi.hssf.record;
 
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The font index record indexes into the font table for the text record.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class FontIndexRecord extends Record {
+public final class FontIndexRecord extends StandardRecord {
     public final static short      sid                             = 0x1026;
     private  short      field_1_fontIndex;
 
@@ -54,16 +54,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_fontIndex);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_fontIndex);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/FrameRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/FrameRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/FrameRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/FrameRecord.java Tue Nov 18 10:49:19 2008
@@ -20,14 +20,14 @@
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * The frame record indicates whether there is a border around the displayed text of a chart.<p/>
  * 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class FrameRecord extends Record {
+public final class FrameRecord extends StandardRecord {
     public final static short sid  = 0x1032;
 
     private static final BitField autoSize     = BitFieldFactory.getInstance(0x1);
@@ -70,17 +70,9 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte[] data)
-    {
-        int pos = 0;
-
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
-
-        LittleEndian.putShort(data, 4 + offset + pos, field_1_borderType);
-        LittleEndian.putShort(data, 6 + offset + pos, field_2_options);
-
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_borderType);
+        out.writeShort(field_2_options);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/GridsetRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/GridsetRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/GridsetRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/GridsetRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Gridset Record.<P>
@@ -34,8 +34,8 @@
  * @version 2.0-pre
  */
 
-public class GridsetRecord
-    extends Record
+public final class GridsetRecord
+    extends StandardRecord
 {
     public final static short sid = 0x82;
     public short              field_1_gridset_flag;
@@ -89,12 +89,8 @@
         return buffer.toString();
     }
 
-    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, field_1_gridset_flag);
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_gridset_flag);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/GutsRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/GutsRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/GutsRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/GutsRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Guts Record <P>
@@ -30,8 +30,8 @@
  * @version 2.0-pre
  */
 
-public class GutsRecord
-    extends Record
+public final class GutsRecord
+    extends StandardRecord
 {
     public final static short sid = 0x80;
     private short             field_1_left_row_gutter;   // size of the row gutter to the left of the rows
@@ -156,15 +156,11 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, ( short ) 0x8);
-        LittleEndian.putShort(data, 4 + offset, getLeftRowGutter());
-        LittleEndian.putShort(data, 6 + offset, getTopColGutter());
-        LittleEndian.putShort(data, 8 + offset, getRowLevelMax());
-        LittleEndian.putShort(data, 10 + offset, getColLevelMax());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getLeftRowGutter());
+        out.writeShort(getTopColGutter());
+        out.writeShort(getRowLevelMax());
+        out.writeShort(getColLevelMax());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/HCenterRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/HCenterRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/HCenterRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/HCenterRecord.java Tue Nov 18 10:49:19 2008
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        HCenter record (0x0083)<P>
@@ -27,7 +27,7 @@
  * @author Jason Height (jheight at chariot dot net dot au)
  * @version 2.0-pre
  */
-public final class HCenterRecord extends Record {
+public final class HCenterRecord extends StandardRecord {
     public final static short sid = 0x0083;
     private short             field_1_hcenter;
 
@@ -78,12 +78,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putUShort(data, 2 + offset, 0x2);
-        LittleEndian.putUShort(data, 4 + offset, field_1_hcenter);
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_hcenter);
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/HideObjRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/HideObjRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/HideObjRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/HideObjRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Hide Object Record<P>
@@ -29,8 +29,8 @@
  * @version 2.0-pre
  */
 
-public class HideObjRecord
-    extends Record
+public final class HideObjRecord
+    extends StandardRecord
 {
     public final static short sid               = 0x8d;
     public final static short HIDE_ALL          = 2;
@@ -86,13 +86,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x02));   // 2 bytes (6 total)
-        LittleEndian.putShort(data, 4 + offset, getHideObj());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getHideObj());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java Tue Nov 18 10:49:19 2008
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title: Interface End Record (0x00E2)<P>
@@ -27,7 +27,7 @@
  * @author Andrew C. Oliver (acoliver at apache dot org)
  * @version 2.0-pre
  */
-public final class InterfaceEndRecord extends Record {
+public final class InterfaceEndRecord extends StandardRecord {
     public final static short sid = 0x00E2;
 
     public InterfaceEndRecord()
@@ -50,12 +50,7 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x00));   // 0 bytes (4 total)
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title: Interface Header Record<P>
@@ -29,8 +29,8 @@
  * @version 2.0-pre
  */
 
-public class InterfaceHdrRecord
-    extends Record
+public final class InterfaceHdrRecord
+    extends StandardRecord
 {
     public final static short sid = 0xe1;
     private short             field_1_codepage;   // = 0;
@@ -85,13 +85,8 @@
         return buffer.toString();
     }
 
-    public int serialize(int offset, byte [] data)
-    {
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset,
-                              (( short ) 0x02));   // 2 bytes (6 total)
-        LittleEndian.putShort(data, 4 + offset, getCodepage());
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(getCodepage());
     }
 
     protected int getDataSize() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/IterationRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/IterationRecord.java?rev=718681&r1=718680&r2=718681&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/IterationRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/IterationRecord.java Tue Nov 18 10:49:19 2008
@@ -19,7 +19,7 @@
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianOutput;
 
 /**
  * Title:        Iteration Record<P>
@@ -33,8 +33,8 @@
  * @version 2.0-pre
  */
 
-public class IterationRecord
-    extends Record
+public final class IterationRecord
+    extends StandardRecord
 {
     public final static short sid = 0x11;
     private short             field_1_iteration;
@@ -87,12 +87,8 @@
         return buffer.toString();
     }
 
-    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, field_1_iteration);
-        return getRecordSize();
+    public void serialize(LittleEndianOutput out) {
+        out.writeShort(field_1_iteration);
     }
 
     protected int getDataSize() {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message