Refactoring Record.serialize methods

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@718681 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-11-18 18:49:19 +00:00
parent d2e7c9c832
commit a9c963b08a
94 changed files with 571 additions and 1127 deletions

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 @@ public final class AreaFormatRecord extends Record {
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() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 @@ public final class AreaRecord extends Record {
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() {

View File

@ -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 @@ public final class AxisLineFormatRecord extends Record {
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() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 @@ public final class AxisOptionsRecord extends Record {
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() {

View File

@ -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 @@ public final class AxisParentRecord extends Record {
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() {

View File

@ -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 @@ public final class AxisRecord extends Record {
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() {

View File

@ -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 @@ public final class AxisUsedRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class BOFRecord
extends Record
public final class BOFRecord
extends StandardRecord
{
/**
@ -272,18 +272,13 @@ public class BOFRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class BackupRecord
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() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 @@ public final class BarRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
*
* @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 @@ public class BeginRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public final class BlankRecord extends Record implements CellValueRecordInterfac
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class BookBoolRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public final class BoolErrRecord extends Record implements CellValueRecordInterf
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() {

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.*;
*
* @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 @@ public final class BottomMarginRecord extends Record implements Margin {
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 @@ public final class BottomMarginRecord extends Record implements Margin {
return rec;
}
} // END OF C
} // END OF

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
*
* @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 @@ public final class CRNCountRecord extends Record {
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;

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class CalcCountRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class CalcModeRecord
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() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 @@ public final class CategorySeriesAxisRecord extends Record {
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() {

View File

@ -19,7 +19,7 @@ package org.apache.poi.hssf.record;
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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public final class ChartFormatRecord extends Record {
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() {

View File

@ -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 @@ public final class ChartRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class CodepageRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.BitFieldFactory;
* @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 @@ public final class ColumnInfoRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class CountryRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class DSFRecord
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() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 @@ public final class DatRecord extends Record {
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() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 @@ public final class DataFormatRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class DateWindow1904Record
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public final class DefaultColWidthRecord extends Record {
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() {

View File

@ -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 @@ public final class DefaultDataLabelTextPropertiesRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class DefaultRowHeightRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class DeltaRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class DimensionsRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public final class EOFRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public final class EndRecord extends Record {
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() {

View File

@ -21,7 +21,7 @@ package org.apache.poi.hssf.record;
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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class ExtendedFormatRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class FilePassRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class FnGroupCountRecord
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() {

View File

@ -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 @@ public final class FontBasisRecord extends Record {
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() {

View File

@ -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 @@ public final class FontIndexRecord extends Record {
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() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 @@ public final class FrameRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class GridsetRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class GutsRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public final class HCenterRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class HideObjRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public final class InterfaceEndRecord extends Record {
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class InterfaceHdrRecord
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() {

View File

@ -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 @@ import org.apache.poi.util.LittleEndian;
* @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 @@ public class IterationRecord
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() {

View File

@ -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: Label SST Record<P>
@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndian;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public final class LabelSSTRecord extends Record implements CellValueRecordInterface {
public final class LabelSSTRecord extends StandardRecord implements CellValueRecordInterface {
public final static short sid = 0xfd;
private int field_1_row;
private int field_2_column;
@ -129,15 +129,11 @@ public final class LabelSSTRecord extends Record implements CellValueRecordInter
return sb.toString();
}
public int serialize(int offset, byte [] data)
{
LittleEndian.putUShort(data, 0 + offset, sid);
LittleEndian.putUShort(data, 2 + offset, 10);
LittleEndian.putUShort(data, 4 + offset, getRow());
LittleEndian.putUShort(data, 6 + offset, getColumn());
LittleEndian.putUShort(data, 8 + offset, getXFIndex());
LittleEndian.putInt(data, 10 + offset, getSSTIndex());
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(getRow());
out.writeShort(getColumn());
out.writeShort(getXFIndex());
out.writeInt(getSSTIndex());
}
protected int getDataSize() {

View File

@ -17,14 +17,14 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Record for the left margin.<p/>
*
* @author Shawn Laubach (slaubach at apache dot org)
*/
public class LeftMarginRecord extends Record implements Margin
public final class LeftMarginRecord extends StandardRecord implements Margin
{
public final static short sid = 0x0026;
private double field_1_margin;
@ -45,12 +45,8 @@ public class LeftMarginRecord extends Record implements Margin
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() {
@ -82,4 +78,4 @@ public class LeftMarginRecord extends Record implements Margin
rec.field_1_margin = this.field_1_margin;
return rec;
}
} // END OF C
} // END OF

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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;
/**
* Defines a legend for a chart.<p/>
*
* @author Andrew C. Oliver (acoliver at apache.org)
*/
public final class LegendRecord extends Record {
public final class LegendRecord extends StandardRecord {
public final static short sid = 0x1015;
private static final BitField autoPosition = BitFieldFactory.getInstance(0x01);
@ -115,22 +115,14 @@ public final class LegendRecord extends Record {
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_xAxisUpperLeft);
LittleEndian.putInt(data, 8 + offset + pos, field_2_yAxisUpperLeft);
LittleEndian.putInt(data, 12 + offset + pos, field_3_xSize);
LittleEndian.putInt(data, 16 + offset + pos, field_4_ySize);
data[ 20 + offset + pos ] = field_5_type;
data[ 21 + offset + pos ] = field_6_spacing;
LittleEndian.putShort(data, 22 + offset + pos, field_7_options);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeInt(field_1_xAxisUpperLeft);
out.writeInt(field_2_yAxisUpperLeft);
out.writeInt(field_3_xSize);
out.writeInt(field_4_ySize);
out.writeByte(field_5_type);
out.writeByte(field_6_spacing);
out.writeShort(field_7_options);
}
protected int getDataSize() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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;
/**
* Describes a line format record. The line format record controls how a line on a chart appears.<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class LineFormatRecord extends Record {
public final class LineFormatRecord extends StandardRecord {
public final static short sid = 0x1007;
private static final BitField auto = BitFieldFactory.getInstance(0x1);
@ -102,20 +102,12 @@ public final class LineFormatRecord extends Record {
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_lineColor);
LittleEndian.putShort(data, 8 + offset + pos, field_2_linePattern);
LittleEndian.putShort(data, 10 + offset + pos, field_3_weight);
LittleEndian.putShort(data, 12 + offset + pos, field_4_format);
LittleEndian.putShort(data, 14 + offset + pos, field_5_colourPaletteIndex);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeInt(field_1_lineColor);
out.writeShort(field_2_linePattern);
out.writeShort(field_3_weight);
out.writeShort(field_4_format);
out.writeShort(field_5_colourPaletteIndex);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: MMS Record<P>
@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class MMSRecord
extends Record
public final class MMSRecord
extends StandardRecord
{
public final static short sid = 0xC1;
private byte field_1_addMenuCount; // = 0;
@ -100,14 +100,9 @@ public class MMSRecord
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)
data[ 4 + offset ] = getAddMenuCount();
data[ 5 + offset ] = getDelMenuCount();
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeByte(getAddMenuCount());
out.writeByte(getDelMenuCount());
}
protected int getDataSize() {

View File

@ -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 format index record indexes format table. This applies to an axis.<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class NumberFormatIndexRecord extends Record {
public final class NumberFormatIndexRecord extends StandardRecord {
public final static short sid = 0x104E;
private short field_1_formatIndex;
@ -54,16 +54,8 @@ public final class NumberFormatIndexRecord extends Record {
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_formatIndex);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_formatIndex);
}
protected int getDataSize() {

View File

@ -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.hssf.record.Record;
/**
@ -28,7 +28,7 @@ import org.apache.poi.hssf.record.Record;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public final class NumberRecord extends Record implements CellValueRecordInterface {
public final class NumberRecord extends StandardRecord implements CellValueRecordInterface {
public static final short sid = 0x0203;
private int field_1_row;
private int field_2_col;
@ -124,22 +124,11 @@ public final class NumberRecord extends Record implements CellValueRecordInterfa
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, 14);
LittleEndian.putUShort(data, 4 + offset, getRow());
LittleEndian.putUShort(data, 6 + offset, getColumn());
LittleEndian.putUShort(data, 8 + offset, getXFIndex());
LittleEndian.putDouble(data, 10 + offset, getValue());
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(getRow());
out.writeShort(getColumn());
out.writeShort(getXFIndex());
out.writeDouble(getValue());
}
protected int getDataSize() {

View File

@ -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;
/**
* Links text to an object on the chart or identifies it as the title.<p/>
*
* @author Andrew C. Oliver (acoliver at apache.org)
*/
public final class ObjectLinkRecord extends Record {
public final class ObjectLinkRecord extends StandardRecord {
public final static short sid = 0x1027;
private short field_1_anchorId;
public final static short ANCHOR_ID_CHART_TITLE = 1;
@ -72,18 +72,10 @@ public final class ObjectLinkRecord extends Record {
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_anchorId);
LittleEndian.putShort(data, 6 + offset + pos, field_2_link1);
LittleEndian.putShort(data, 8 + offset + pos, field_3_link2);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_anchorId);
out.writeShort(field_2_link1);
out.writeShort(field_3_link2);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Object Protect Record<P>
@ -31,8 +31,8 @@ import org.apache.poi.util.LittleEndian;
* @author Andrew C. Oliver (acoliver at apache dot org)
*/
public class ObjectProtectRecord
extends Record
public final class ObjectProtectRecord
extends StandardRecord
{
public final static short sid = 0x63;
private short field_1_protect;
@ -84,13 +84,8 @@ public class ObjectProtectRecord
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_protect);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_protect);
}
protected int getDataSize() {

View File

@ -19,14 +19,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;
/**
* Describes the frozen and unfozen panes.<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class PaneRecord extends Record {
public final class PaneRecord extends StandardRecord {
public final static short sid = 0x41;
private short field_1_x;
private short field_2_y;
@ -86,20 +86,12 @@ public final class PaneRecord extends Record {
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_x);
LittleEndian.putShort(data, 6 + offset + pos, field_2_y);
LittleEndian.putShort(data, 8 + offset + pos, field_3_topRow);
LittleEndian.putShort(data, 10 + offset + pos, field_4_leftColumn);
LittleEndian.putShort(data, 12 + offset + pos, field_5_activePane);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_x);
out.writeShort(field_2_y);
out.writeShort(field_3_topRow);
out.writeShort(field_4_leftColumn);
out.writeShort(field_5_activePane);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Password Record<P>
@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class PasswordRecord extends Record {
public final class PasswordRecord extends StandardRecord {
public final static short sid = 0x13;
private short field_1_password; // not sure why this is only 2 bytes, but it is... go figure
@ -88,12 +88,8 @@ public class PasswordRecord extends Record {
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, getPassword());
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(getPassword());
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Protection Revision 4 password Record<P>
@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class PasswordRev4Record
extends Record
public final class PasswordRev4Record
extends StandardRecord
{
public final static short sid = 0x1BC;
private short field_1_password;
@ -78,13 +78,8 @@ public class PasswordRev4Record
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, getPassword());
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(getPassword());
}
protected int getDataSize() {

View File

@ -17,14 +17,14 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* preceeds and identifies a frame as belonging to the plot area.<p/>
*
* @author Andrew C. Oliver (acoliver at apache.org)
*/
public final class PlotAreaRecord extends Record {
public final class PlotAreaRecord extends StandardRecord {
public final static short sid = 0x1035;
@ -51,13 +51,7 @@ public final class PlotAreaRecord extends Record {
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
return getRecordSize();
public void serialize(LittleEndianOutput out) {
}
protected int getDataSize() {

View File

@ -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 plot growth record specifies the scaling factors used when a font is scaled.<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class PlotGrowthRecord extends Record {
public final class PlotGrowthRecord extends StandardRecord {
public final static short sid = 0x1064;
private int field_1_horizontalScale;
private int field_2_verticalScale;
@ -61,17 +61,9 @@ public final class PlotGrowthRecord extends Record {
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_horizontalScale);
LittleEndian.putInt(data, 8 + offset + pos, field_2_verticalScale);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeInt(field_1_horizontalScale);
out.writeInt(field_2_verticalScale);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Precision Record<P>
@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class PrecisionRecord
extends Record
public final class PrecisionRecord
extends StandardRecord
{
public final static short sid = 0xE;
public short field_1_precision;
@ -85,13 +85,8 @@ public class PrecisionRecord
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_precision);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_precision);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Print Gridlines Record<P>
@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class PrintGridlinesRecord
extends Record
public final class PrintGridlinesRecord
extends StandardRecord
{
public final static short sid = 0x2b;
private short field_1_print_gridlines;
@ -85,12 +85,8 @@ public class PrintGridlinesRecord
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_print_gridlines);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_print_gridlines);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Print Headers Record<P>
@ -31,8 +31,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class PrintHeadersRecord
extends Record
public final class PrintHeadersRecord
extends StandardRecord
{
public final static short sid = 0x2a;
private short field_1_print_headers;
@ -84,12 +84,8 @@ public class PrintHeadersRecord
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_print_headers);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_print_headers);
}
protected int getDataSize() {

View File

@ -17,7 +17,7 @@
package org.apache.poi.hssf.record;
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 @@ import org.apache.poi.util.BitFieldFactory;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public class PrintSetupRecord extends Record {
public final class PrintSetupRecord extends StandardRecord {
public final static short sid = 0x00A1;
private short field_1_paper_size;
private short field_2_scale;
@ -322,22 +322,18 @@ public class PrintSetupRecord extends Record {
return buffer.toString();
}
public int serialize(int offset, byte [] data)
{
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, ( short ) 34);
LittleEndian.putShort(data, 4 + offset, getPaperSize());
LittleEndian.putShort(data, 6 + offset, getScale());
LittleEndian.putShort(data, 8 + offset, getPageStart());
LittleEndian.putShort(data, 10 + offset, getFitWidth());
LittleEndian.putShort(data, 12 + offset, getFitHeight());
LittleEndian.putShort(data, 14 + offset, getOptions());
LittleEndian.putShort(data, 16 + offset, getHResolution());
LittleEndian.putShort(data, 18 + offset, getVResolution());
LittleEndian.putDouble(data, 20 + offset, getHeaderMargin());
LittleEndian.putDouble(data, 28 + offset, getFooterMargin());
LittleEndian.putShort(data, 36 + offset, getCopies());
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(getPaperSize());
out.writeShort(getScale());
out.writeShort(getPageStart());
out.writeShort(getFitWidth());
out.writeShort(getFitHeight());
out.writeShort(getOptions());
out.writeShort(getHResolution());
out.writeShort(getVResolution());
out.writeDouble(getHeaderMargin());
out.writeDouble(getFooterMargin());
out.writeShort(getCopies());
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Protect Record<P>
@ -32,8 +32,8 @@ import org.apache.poi.util.LittleEndian;
* @author Andrew C. Oliver (acoliver at apache dot org)
*/
public class ProtectRecord
extends Record
public final class ProtectRecord
extends StandardRecord
{
public final static short sid = 0x12;
private short field_1_protect;
@ -85,13 +85,8 @@ public class ProtectRecord
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_protect);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_protect);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Protection Revision 4 Record<P>
@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class ProtectionRev4Record
extends Record
public final class ProtectionRev4Record
extends StandardRecord
{
public final static short sid = 0x1af;
private short field_1_protect;
@ -83,13 +83,8 @@ public class ProtectionRev4Record
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_protect);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_protect);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: RefMode Record<P>
@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class RefModeRecord
extends Record
public final class RefModeRecord
extends StandardRecord
{
public final static short sid = 0xf;
public final static short USE_A1_MODE = 1;
@ -83,12 +83,8 @@ public class RefModeRecord
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, getMode());
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(getMode());
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Refresh All Record <P>
@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class RefreshAllRecord
extends Record
public final class RefreshAllRecord
extends StandardRecord
{
public final static short sid = 0x1B7;
private short field_1_refreshall;
@ -83,13 +83,8 @@ public class RefreshAllRecord
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_refreshall);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_refreshall);
}
protected int getDataSize() {

View File

@ -17,14 +17,14 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Record for the right margin.<p/>
*
* @author Shawn Laubach (slaubach at apache dot org)
*/
public final class RightMarginRecord extends Record implements Margin {
public final class RightMarginRecord extends StandardRecord implements Margin {
public final static short sid = 0x27;
private double field_1_margin;
@ -44,12 +44,8 @@ public final class RightMarginRecord extends Record implements Margin {
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() {
@ -75,4 +71,4 @@ public final class RightMarginRecord extends Record implements Margin {
rec.field_1_margin = this.field_1_margin;
return rec;
}
} // END OF
} // END OF

View File

@ -20,7 +20,7 @@ package org.apache.poi.hssf.record;
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;
/**
* Title: Row Record (0x0208)<P/>
@ -30,7 +30,7 @@ import org.apache.poi.util.LittleEndian;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public final class RowRecord extends Record {
public final class RowRecord extends StandardRecord {
public final static short sid = 0x0208;
public static final int ENCODED_SIZE = 20;
@ -335,20 +335,15 @@ public final class RowRecord extends Record {
return sb.toString();
}
public int serialize(int offset, byte [] data)
{
LittleEndian.putUShort(data, 0 + offset, sid);
LittleEndian.putUShort(data, 2 + offset, ENCODED_SIZE - 4);
LittleEndian.putUShort(data, 4 + offset, getRowNumber());
LittleEndian.putUShort(data, 6 + offset, getFirstCol() == -1 ? (short)0 : getFirstCol());
LittleEndian.putUShort(data, 8 + offset, getLastCol() == -1 ? (short)0 : getLastCol());
LittleEndian.putUShort(data, 10 + offset, getHeight());
LittleEndian.putUShort(data, 12 + offset, getOptimize());
LittleEndian.putUShort(data, 14 + offset, field_6_reserved);
LittleEndian.putUShort(data, 16 + offset, getOptionFlags());
LittleEndian.putUShort(data, 18 + offset, getXFIndex());
return ENCODED_SIZE;
public void serialize(LittleEndianOutput out) {
out.writeShort(getRowNumber());
out.writeShort(getFirstCol() == -1 ? (short)0 : getFirstCol());
out.writeShort(getLastCol() == -1 ? (short)0 : getLastCol());
out.writeShort(getHeight());
out.writeShort(getOptimize());
out.writeShort(field_6_reserved);
out.writeShort(getOptionFlags());
out.writeShort(getXFIndex());
}
protected int getDataSize() {

View File

@ -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;
/**
* Specifies the window's zoom magnification. <p/>
@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndian;
*
* @author Andrew C. Oliver (acoliver at apache.org)
*/
public final class SCLRecord extends Record {
public final class SCLRecord extends StandardRecord {
public final static short sid = 0x00A0;
private short field_1_numerator;
private short field_2_denominator;
@ -61,17 +61,9 @@ public final class SCLRecord extends Record {
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_numerator);
LittleEndian.putShort(data, 6 + offset + pos, field_2_denominator);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_numerator);
out.writeShort(field_2_denominator);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Save Recalc Record <P>
@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class SaveRecalcRecord
extends Record
public final class SaveRecalcRecord
extends StandardRecord
{
public final static short sid = 0x5f;
private short field_1_recalc;
@ -77,12 +77,8 @@ public class SaveRecalcRecord
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_recalc);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_recalc);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Scenario Protect Record<P>
@ -32,8 +32,8 @@ import org.apache.poi.util.LittleEndian;
* @author Andrew C. Oliver (acoliver at apache dot org)
*/
public class ScenarioProtectRecord
extends Record
public final class ScenarioProtectRecord
extends StandardRecord
{
public final static short sid = 0xdd;
private short field_1_protect;
@ -85,13 +85,8 @@ public class ScenarioProtectRecord
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_protect);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_protect);
}
protected int getDataSize() {

View File

@ -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 series chart group index record stores the index to the CHARTFORMAT record (0 based).<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class SeriesChartGroupIndexRecord extends Record {
public final class SeriesChartGroupIndexRecord extends StandardRecord {
public final static short sid = 0x1045;
private short field_1_chartGroupIndex;
@ -54,16 +54,8 @@ public final class SeriesChartGroupIndexRecord extends Record {
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_chartGroupIndex);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_chartGroupIndex);
}
protected int getDataSize() {

View File

@ -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;
/**
* links a series to its position in the series list.<p/>
*
* @author Andrew C. Oliver (acoliver at apache.org)
*/
public final class SeriesIndexRecord extends Record {
public final class SeriesIndexRecord extends StandardRecord {
public final static short sid = 0x1065;
private short field_1_index;
@ -54,16 +54,8 @@ public final class SeriesIndexRecord extends Record {
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_index);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_index);
}
protected int getDataSize() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 series label record defines the type of label associated with the data format record.<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class SeriesLabelsRecord extends Record {
public final class SeriesLabelsRecord extends StandardRecord {
public final static short sid = 0x100c;
private static final BitField showActual = BitFieldFactory.getInstance(0x01);
@ -69,16 +69,8 @@ public final class SeriesLabelsRecord extends Record {
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() {

View File

@ -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 series record describes the overall data for a series.<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class SeriesRecord extends Record {
public final class SeriesRecord extends StandardRecord {
public final static short sid = 0x1003;
private short field_1_categoryDataType;
public final static short CATEGORY_DATA_TYPE_DATES = 0;
@ -97,21 +97,13 @@ public final class SeriesRecord extends Record {
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);
LittleEndian.putShort(data, 6 + offset + pos, field_2_valuesDataType);
LittleEndian.putShort(data, 8 + offset + pos, field_3_numCategories);
LittleEndian.putShort(data, 10 + offset + pos, field_4_numValues);
LittleEndian.putShort(data, 12 + offset + pos, field_5_bubbleSeriesType);
LittleEndian.putShort(data, 14 + offset + pos, field_6_numBubbleValues);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_categoryDataType);
out.writeShort(field_2_valuesDataType);
out.writeShort(field_3_numCategories);
out.writeShort(field_4_numValues);
out.writeShort(field_5_bubbleSeriesType);
out.writeShort(field_6_numBubbleValues);
}
protected int getDataSize() {

View File

@ -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;
/**
* Indicates the chart-group index for a series. The order probably defines the mapping.
@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndian;
*
* @author Andrew C. Oliver (acoliver at apache.org)
*/
public final class SeriesToChartGroupRecord extends Record {
public final class SeriesToChartGroupRecord extends StandardRecord {
public final static short sid = 0x1045;
private short field_1_chartGroupIndex;
@ -56,16 +56,8 @@ public final class SeriesToChartGroupRecord extends Record {
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_chartGroupIndex);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_chartGroupIndex);
}
protected int getDataSize() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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;
/**
* Describes a chart sheet properties record.<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class SheetPropertiesRecord extends Record {
public final class SheetPropertiesRecord extends StandardRecord {
public final static short sid = 0x1044;
private static final BitField chartTypeManuallyFormatted = BitFieldFactory.getInstance(0x01);
@ -77,17 +77,9 @@ public final class SheetPropertiesRecord extends Record {
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_flags);
data[ 6 + offset + pos ] = field_2_empty;
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_flags);
out.writeByte(field_2_empty);
}
protected int getDataSize() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 text record is used to define text stored on a chart.<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class TextRecord extends Record {
public final class TextRecord extends StandardRecord {
public final static short sid = 0x1025;
private static final BitField dataLabelPlacement = BitFieldFactory.getInstance(0x000F);
@ -179,27 +179,19 @@ public final class TextRecord extends Record {
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));
data[ 4 + offset + pos ] = field_1_horizontalAlignment;
data[ 5 + offset + pos ] = field_2_verticalAlignment;
LittleEndian.putShort(data, 6 + offset + pos, field_3_displayMode);
LittleEndian.putInt(data, 8 + offset + pos, field_4_rgbColor);
LittleEndian.putInt(data, 12 + offset + pos, field_5_x);
LittleEndian.putInt(data, 16 + offset + pos, field_6_y);
LittleEndian.putInt(data, 20 + offset + pos, field_7_width);
LittleEndian.putInt(data, 24 + offset + pos, field_8_height);
LittleEndian.putShort(data, 28 + offset + pos, field_9_options1);
LittleEndian.putShort(data, 30 + offset + pos, field_10_indexOfColorValue);
LittleEndian.putShort(data, 32 + offset + pos, field_11_options2);
LittleEndian.putShort(data, 34 + offset + pos, field_12_textRotation);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeByte(field_1_horizontalAlignment);
out.writeByte(field_2_verticalAlignment);
out.writeShort(field_3_displayMode);
out.writeInt(field_4_rgbColor);
out.writeInt(field_5_x);
out.writeInt(field_6_y);
out.writeInt(field_7_width);
out.writeInt(field_8_height);
out.writeShort(field_9_options1);
out.writeShort(field_10_indexOfColorValue);
out.writeShort(field_11_options2);
out.writeShort(field_12_textRotation);
}
protected int getDataSize() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 Tick record defines how tick marks and label positioning/formatting<p/>
*
* @author Andrew C. Oliver(acoliver at apache.org)
*/
public final class TickRecord extends Record {
public final class TickRecord extends StandardRecord {
public final static short sid = 0x101E;
private static final BitField autoTextColor = BitFieldFactory.getInstance(0x1);
@ -126,27 +126,19 @@ public final class TickRecord extends Record {
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));
data[ 4 + offset + pos ] = field_1_majorTickType;
data[ 5 + offset + pos ] = field_2_minorTickType;
data[ 6 + offset + pos ] = field_3_labelPosition;
data[ 7 + offset + pos ] = field_4_background;
LittleEndian.putInt(data, 8 + offset + pos, field_5_labelColorRgb);
LittleEndian.putInt(data, 12 + offset + pos, field_6_zero1);
LittleEndian.putInt(data, 16 + offset + pos, field_7_zero2);
LittleEndian.putInt(data, 20 + offset + pos, field_8_zero3);
LittleEndian.putInt(data, 24 + offset + pos, field_9_zero4);
LittleEndian.putShort(data, 28 + offset + pos, field_10_options);
LittleEndian.putShort(data, 30 + offset + pos, field_11_tickColor);
LittleEndian.putShort(data, 32 + offset + pos, field_12_zero5);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeByte(field_1_majorTickType);
out.writeByte(field_2_minorTickType);
out.writeByte(field_3_labelPosition);
out.writeByte(field_4_background);
out.writeInt(field_5_labelColorRgb);
out.writeInt(field_6_zero1);
out.writeInt(field_7_zero2);
out.writeInt(field_8_zero3);
out.writeInt(field_9_zero4);
out.writeShort(field_10_options);
out.writeShort(field_11_tickColor);
out.writeShort(field_12_zero5);
}
protected int getDataSize() {

View File

@ -24,7 +24,7 @@ import org.apache.poi.util.*;
*
* @author Shawn Laubach (slaubach at apache dot org)
*/
public final class TopMarginRecord extends Record implements Margin {
public final class TopMarginRecord extends StandardRecord implements Margin {
public final static short sid = 0x28;
private double field_1_margin;
@ -47,12 +47,8 @@ public final class TopMarginRecord extends Record implements Margin {
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() {
@ -78,4 +74,4 @@ public final class TopMarginRecord extends Record implements Margin {
rec.field_1_margin = this.field_1_margin;
return rec;
}
} // END OF C
} // END OF

View File

@ -17,7 +17,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Uncalced Record
@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndian;
*
* @author Olivier Leprince
*/
public final class UncalcedRecord extends Record {
public final class UncalcedRecord extends StandardRecord {
public final static short sid = 0x005E;
public UncalcedRecord() {
@ -48,11 +48,8 @@ public final class UncalcedRecord extends Record {
return buffer.toString();
}
public int serialize(int offset, byte[] data) {
LittleEndian.putUShort(data, 0 + offset, sid);
LittleEndian.putUShort(data, 2 + offset, 2);
LittleEndian.putUShort(data, 4 + offset, 0); // unused
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(0);
}
protected int getDataSize() {

View File

@ -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 units record describes units.<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class UnitsRecord extends Record {
public final class UnitsRecord extends StandardRecord {
public final static short sid = 0x1001;
private short field_1_units;
@ -55,16 +55,8 @@ public final class UnitsRecord extends Record {
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_units);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_units);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Use Natural Language Formulas Flag<P>
@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class UseSelFSRecord
extends Record
public final class UseSelFSRecord
extends StandardRecord
{
public final static short sid = 0x160;
public final static short TRUE = 1;
@ -84,13 +84,8 @@ public class UseSelFSRecord
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, getFlag());
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(getFlag());
}
protected int getDataSize() {

View File

@ -17,7 +17,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: VCenter record<P>
@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public final class VCenterRecord extends Record {
public final class VCenterRecord extends StandardRecord {
public final static short sid = 0x84;
private int field_1_vcenter;
@ -72,12 +72,8 @@ public final class VCenterRecord extends Record {
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, field_1_vcenter);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_vcenter);
}
protected int getDataSize() {

View File

@ -20,14 +20,14 @@ package org.apache.poi.hssf.record;
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 value range record defines the range of the value axis.<p/>
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class ValueRangeRecord extends Record {
public final class ValueRangeRecord extends StandardRecord {
public final static short sid = 0x101f;
private static final BitField automaticMinimum = BitFieldFactory.getInstance(0x0001);
@ -102,21 +102,13 @@ public final class ValueRangeRecord extends Record {
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.putDouble(data, 4 + offset + pos, field_1_minimumAxisValue);
LittleEndian.putDouble(data, 12 + offset + pos, field_2_maximumAxisValue);
LittleEndian.putDouble(data, 20 + offset + pos, field_3_majorIncrement);
LittleEndian.putDouble(data, 28 + offset + pos, field_4_minorIncrement);
LittleEndian.putDouble(data, 36 + offset + pos, field_5_categoryAxisCross);
LittleEndian.putShort(data, 44 + offset + pos, field_6_options);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeDouble(field_1_minimumAxisValue);
out.writeDouble(field_2_maximumAxisValue);
out.writeDouble(field_3_majorIncrement);
out.writeDouble(field_4_minorIncrement);
out.writeDouble(field_5_categoryAxisCross);
out.writeShort(field_6_options);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@ package org.apache.poi.hssf.record;
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: WSBool Record.<p>
@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndian;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public final class WSBoolRecord extends Record {
public final class WSBoolRecord extends StandardRecord {
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 inconsistently use it as 2 separate bytes
@ -316,13 +316,9 @@ public final class WSBoolRecord extends Record {
return buffer.toString();
}
public int serialize(int offset, byte [] data)
{
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, ( short ) 0x2);
data[ 5 + offset ] = getWSBool1();
data[ 4 + offset ] = getWSBool2();
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeByte(getWSBool2());
out.writeByte(getWSBool1());
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@ package org.apache.poi.hssf.record;
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: Window1 Record<P>
@ -30,7 +30,7 @@ import org.apache.poi.util.LittleEndian;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/
public final class WindowOneRecord extends Record {
public final class WindowOneRecord extends StandardRecord {
public final static short sid = 0x3d;
// our variable names stolen from old TV sets.
@ -422,21 +422,16 @@ public final class WindowOneRecord extends Record {
return buffer.toString();
}
public int serialize(int offset, byte [] data)
{
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset,
(( short ) 0x12)); // 18 bytes (22 total)
LittleEndian.putShort(data, 4 + offset, getHorizontalHold());
LittleEndian.putShort(data, 6 + offset, getVerticalHold());
LittleEndian.putShort(data, 8 + offset, getWidth());
LittleEndian.putShort(data, 10 + offset, getHeight());
LittleEndian.putShort(data, 12 + offset, getOptions());
LittleEndian.putUShort(data, 14 + offset, getActiveSheetIndex());
LittleEndian.putUShort(data, 16 + offset, getFirstVisibleTab());
LittleEndian.putShort(data, 18 + offset, getNumSelectedTabs());
LittleEndian.putShort(data, 20 + offset, getTabWidthRatio());
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(getHorizontalHold());
out.writeShort(getVerticalHold());
out.writeShort(getWidth());
out.writeShort(getHeight());
out.writeShort(getOptions());
out.writeShort(getActiveSheetIndex());
out.writeShort(getFirstVisibleTab());
out.writeShort(getNumSelectedTabs());
out.writeShort(getTabWidthRatio());
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Window Protect Record<P>
@ -29,8 +29,8 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
public class WindowProtectRecord
extends Record
public final class WindowProtectRecord
extends StandardRecord
{
public final static short sid = 0x19;
private short field_1_protect;
@ -83,13 +83,8 @@ public class WindowProtectRecord
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_protect);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(field_1_protect);
}
protected int getDataSize() {

View File

@ -19,7 +19,7 @@ package org.apache.poi.hssf.record;
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: Window Two Record<P>
@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndian;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
public final class WindowTwoRecord extends Record {
public final class WindowTwoRecord extends StandardRecord {
public final static short sid = 0x023E;
// bitfields
@ -523,18 +523,14 @@ public final class WindowTwoRecord extends Record {
return buffer.toString();
}
public int serialize(int offset, byte [] data)
{
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, ( short ) 18);
LittleEndian.putShort(data, 4 + offset, getOptions());
LittleEndian.putShort(data, 6 + offset, getTopRow());
LittleEndian.putShort(data, 8 + offset, getLeftCol());
LittleEndian.putInt(data, 10 + offset, getHeaderColor());
LittleEndian.putShort(data, 14 + offset, getPageBreakZoom());
LittleEndian.putShort(data, 16 + offset, getNormalZoom());
LittleEndian.putInt(data, 18 + offset, getReserved());
return getRecordSize();
public void serialize(LittleEndianOutput out) {
out.writeShort(getOptions());
out.writeShort(getTopRow());
out.writeShort(getLeftCol());
out.writeInt(getHeaderColor());
out.writeShort(getPageBreakZoom());
out.writeShort(getNormalZoom());
out.writeInt(getReserved());
}
protected int getDataSize() {

View File

@ -17,7 +17,7 @@
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianOutput;
/**
* Title: Write Protect Record<P>
@ -25,7 +25,7 @@ import org.apache.poi.util.LittleEndian;
* REFERENCE: PG 425 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @version 3.0-pre
*/
public final class WriteProtectRecord extends Record {
public final class WriteProtectRecord extends StandardRecord {
public final static short sid = 0x86;
public WriteProtectRecord()
@ -48,12 +48,7 @@ public final class WriteProtectRecord extends Record {
return buffer.toString();
}
public int serialize(int offset, byte [] data)
{
LittleEndian.putUShort(data, 0 + offset, sid);
LittleEndian.putUShort(data, 2 + offset, 0);
return getRecordSize();
public void serialize(LittleEndianOutput out) {
}
protected int getDataSize() {