| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.poi.ddf.EscherRecord
public abstract class EscherRecord
The base abstract record from which all escher records are defined. Subclasses will need to define methods for serialization/deserialization and for determining the record size.
| Constructor Summary | |
|---|---|
| EscherRecord()Create a new instance | |
| Method Summary | |
|---|---|
|  EscherRecord | clone()Escher records may need to be clonable in the future. | 
|  void | display(java.io.PrintWriter w,
        int indent)The display methods allows escher variables to print the record names according to their hierarchy. | 
| protected  int | fillFields(byte[] data,
           EscherRecordFactory f)Delegates to fillFields(byte[], int, EscherRecordFactory) | 
| abstract  int | fillFields(byte[] data,
           int offset,
           EscherRecordFactory recordFactory)The contract of this method is to deserialize an escher record including it's children. | 
| protected abstract  java.lang.Object[][] | getAttributeMap()For the purpose of providing toString() and toXml() a subclass can either override those methods or provide a Object[][] array in the form { { "Attribute Name (Header)", value, "optional attribute", value }, ... | 
|  EscherRecord | getChild(int index)Returns the indexed child record. | 
|  java.util.List<EscherRecord> | getChildRecords() | 
|  short | getInstance()Returns the instance part of the option record. | 
|  short | getOptions()Note that optionsis an internal field. | 
|  short | getRecordId()Return the current record id. | 
| abstract  java.lang.String | getRecordName()Subclasses should return the short name for this escher record. | 
| abstract  int | getRecordSize()Subclasses should effeciently return the number of bytes required to serialize the record. | 
|  short | getVersion()Returns the version part of the option record. | 
|  boolean | isContainerRecord()Determine whether this is a container record by inspecting the option field. | 
| protected  int | readHeader(byte[] data,
           int offset)Reads the 8 byte header information and populates the optionsandrecordIdrecords. | 
| protected static short | readInstance(byte[] data,
             int offset)Read the options field from header and return instance part of it. | 
|  byte[] | serialize()Serializes to a new byte array. | 
|  int | serialize(int offset,
          byte[] data)Serializes to an existing byte array without serialization listener. | 
| abstract  int | serialize(int offset,
          byte[] data,
          EscherSerializationListener listener)Serializes the record to an existing byte array. | 
|  void | setChildRecords(java.util.List<EscherRecord> childRecords)Sets the child records for this record. | 
|  void | setInstance(short value)Sets the instance part of record | 
|  void | setOptions(short options)Set the options this this record. | 
|  void | setRecordId(short recordId)Sets the record id for this record. | 
|  void | setVersion(short value)Sets the version part of record | 
|  java.lang.String | toString() | 
|  java.lang.String | toXml() | 
|  java.lang.String | toXml(java.lang.String tab) | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public EscherRecord()
| Method Detail | 
|---|
protected int fillFields(byte[] data,
                         EscherRecordFactory f)
data - they bytes to serialize fromf - the escher record factory
fillFields(byte[], int, org.apache.poi.ddf.EscherRecordFactory)
public abstract int fillFields(byte[] data,
                               int offset,
                               EscherRecordFactory recordFactory)
data - The byte array containing the serialized escher
                  records.offset - The offset into the byte array.recordFactory - A factory for creating new escher records.
protected int readHeader(byte[] data,
                         int offset)
options
 and recordId records.
data - the byte array to read fromoffset - the offset to start reading from
protected static short readInstance(byte[] data,
                                    int offset)
data - the byte array to read fromoffset - the offset to start reading from
public boolean isContainerRecord()
@Internal public short getOptions()
options is an internal field.
 Use setInstance(short) ()} and setVersion(short) ()} to set the actual fields.
@Internal public void setOptions(short options)
 Note that options is an internal field.
 Use getInstance() and getVersion() to access actual fields.
options - the record optionspublic byte[] serialize()
serialize(int, byte[])
public int serialize(int offset,
                     byte[] data)
offset - the offset within the data byte array.data - the data array to serialize to.
serialize(int, byte[], org.apache.poi.ddf.EscherSerializationListener)
public abstract int serialize(int offset,
                              byte[] data,
                              EscherSerializationListener listener)
offset - the offset within the byte arraydata - the data array to serialize tolistener - a listener for begin and end serialization events.  This
                  is useful because the serialization is
                  hierarchical/recursive and sometimes you need to be able
                  break into that.
public abstract int getRecordSize()
public short getRecordId()
public void setRecordId(short recordId)
recordId - the record idpublic java.util.List<EscherRecord> getChildRecords()
EscherContainerRecordpublic void setChildRecords(java.util.List<EscherRecord> childRecords)
childRecords - Not used in base implementation.
public EscherRecord clone()
                   throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException - if the subclass hasn't implemented Cloneablepublic EscherRecord getChild(int index)
index - the index of the child within the child records
public void display(java.io.PrintWriter w,
                    int indent)
w - The print writer to output to.indent - The current indent level.public abstract java.lang.String getRecordName()
public short getInstance()
public void setInstance(short value)
value - instance part valuepublic short getVersion()
public void setVersion(short value)
value - version part valuepublic java.lang.String toXml()
public final java.lang.String toXml(java.lang.String tab)
tab - - each children must be indented right relative to its parent
public final java.lang.String toString()
toString in class java.lang.Object@Internal protected abstract java.lang.Object[][] getAttributeMap()
{ { "Attribute Name (Header)", value, "optional attribute", value }, ... } .Null values won't be printed.
The attributes record, version, instance, options must not be returned.
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||