FileDocCategorySizeDatePackage
Record.javaAPI DocApache Poi 3.0.14186Mon Jan 01 12:39:40 GMT 2007org.apache.poi.hssf.record

Record

public abstract class Record extends Object
Title: Record Description: All HSSF Records inherit from this class. It populates the fields common to all records (id, size and data). Subclasses should be sure to validate the id, Company:
author
Andrew C. Oliver
author
Marc Johnson (mjohnson at apache dot org)
author
Jason Height (jheight at chariot dot net dot au)
version
2.0-pre

Fields Summary
Constructors Summary
public Record()
instantiates a blank record strictly for ID matching

    
public Record(RecordInputStream in)
Constructor Record

param
id record id
param
size record size
param
data raw data

        validateSid(in.getSid());
        fillFields(in);
    
Methods Summary
public java.lang.Objectclone()

      throw new RuntimeException("The class "+getClass().getName()+" needs to define a clone method");
    
protected abstract voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)
called by the constructor, should set class level fields. Should throw runtime exception for bad/icomplete data.

param
data raw data
param
size size of data
param
offset of the record's data (provided a big array of the file)

public intgetRecordSize()
gives the current serialized size of the record. Should include the sid and reclength (4 bytes).


        // this is kind od a stupid way to do it but for now we just serialize
        // the record and return the size of the byte array
        return serialize().length;
    
public abstract shortgetSid()
return the non static version of the id for this record.

public booleanisInValueSection()
DBCELL, ROW, VALUES all say yes

        return false;
    
public booleanisValue()
tells whether this type of record contains a value

        return false;
    
public byte[]serialize()
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

        byte[] retval = new byte[ getRecordSize() ];

        serialize(0, retval);
        return retval;
    
public abstract intserialize(int offset, byte[] data)
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.

param
offset to begin writing at
param
data byte array containing instance data
return
number of bytes written

public java.lang.StringtoString()
get a string representation of the record (for biffview/debugging)

        return super.toString();
    
protected abstract voidvalidateSid(short id)
called by constructor, should throw runtime exception in the event of a record passed with a differing ID.

param
id alleged id for this record