Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.ddf
Class EscherRecord

    java.lang.Object
      org.apache.poi.ddf.EscherRecord

Direct Known Subclasses:
  EscherBlipRecord, EscherBSERecord, EscherChildAnchorRecord, EscherClientAnchorRecord, EscherClientDataRecord, EscherContainerRecord, EscherDggRecord, EscherDgRecord, EscherOptRecord, EscherSpgrRecord, EscherSplitMenuColorsRecord, EscherSpRecord, EscherTextboxRecord, UnknownEscherRecord

    public abstract class EscherRecord

extends java.lang.Object

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.

Author:
  Glen Stampoultzis

Constructor Summary
`EscherRecord()` Create a new instance

Method Summary
`java.lang.Object` | `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.
`abstract int` | `fillFields(byte[] data, int offset, EscherRecordFactory recordFactory)` The contract of this method is to deserialize an escher record including it's children.
`EscherRecord` | `getChild(int index)` Returns the indexed child record.
`java.util.List` | `getChildRecords()`
`short` | `getInstance()` Returns the instance part of the option record.
`short` | `getOptions()`
`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.
`boolean` | `isContainerRecord()` Determine whether this is a container record by inspecting the option field.
`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 childRecords)` Sets the child records for this record.
`void` | `setOptions(short options)` Set the options this this record.
`void` | `setRecordId(short recordId)` Sets the record id for this record.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EscherRecord

    public EscherRecord()

  Create a new instance

Method Detail

### fillFields

    public abstract int fillFields(byte[] data,
                                   int offset,
                                   EscherRecordFactory recordFactory)

  The contract of this method is to deserialize an escher record including it's children.

  Parameters:
    `data` - The byte array containing the serialized escher records.
    `offset` - The offset into the byte array.
    `recordFactory` - A factory for creating new escher records.
  Returns:
    The number of bytes written.

### isContainerRecord

    public boolean isContainerRecord()

  Determine whether this is a container record by inspecting the option field.

  Returns:
    true is this is a container field.

### getOptions

    public short getOptions()

  Returns:
    The options field for this record. All records have one.

### setOptions

    public void setOptions(short options)

  Set the options this this record. Container records should have the last nibble set to 0xF.

### serialize

    public byte[] serialize()

  Serializes to a new byte array. This is done by delegating to serialize(int, byte[]);

  Returns:
    the serialized record.
  See Also:
    `serialize(int, byte[])`

### serialize

    public int serialize(int offset,
                         byte[] data)

  Serializes to an existing byte array without serialization listener. This is done by delegating to serialize(int, byte[], EscherSerializationListener).

  Parameters:
    `offset` - the offset within the data byte array.
    `data` - the data array to serialize to.
  Returns:
    The number of bytes written.
  See Also:
    `serialize(int, byte[], org.apache.poi.ddf.EscherSerializationListener)`

### serialize

    public abstract int serialize(int offset,
                                  byte[] data,
                                  EscherSerializationListener listener)

  Serializes the record to an existing byte array.

  Parameters:
    `offset` - the offset within the byte array
    `data` - the data array to serialize to
    `listener` - 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.
  Returns:
    the number of bytes written.

### getRecordSize

    public abstract int getRecordSize()

  Subclasses should effeciently return the number of bytes required to serialize the record.

  Returns:
    number of bytes

### getRecordId

    public short getRecordId()

  Return the current record id.

  Returns:
    The 16 bit record id.

### setRecordId

    public void setRecordId(short recordId)

  Sets the record id for this record.

### getChildRecords

    public java.util.List getChildRecords()

  Returns:
    Returns the children of this record. By default this will be an empty list. EscherCotainerRecord is the only record that may contain children.
  See Also:
    `EscherContainerRecord`

### setChildRecords

    public void setChildRecords(java.util.List childRecords)

  Sets the child records for this record. By default this will throw an exception as only EscherContainerRecords may have children.

  Parameters:
    `childRecords` - Not used in base implementation.

### clone

    public java.lang.Object clone()

  Escher records may need to be clonable in the future.

  Overrides:
    `clone` in class `java.lang.Object`

### getChild

    public EscherRecord getChild(int index)

  Returns the indexed child record.

### display

    public void display(java.io.PrintWriter w,
                        int indent)

  The display methods allows escher variables to print the record names according to their hierarchy.

  Parameters:
    `w` - The print writer to output to.
    `indent` - The current indent level.

### getRecordName

    public abstract java.lang.String getRecordName()

  Subclasses should return the short name for this escher record.

### getInstance

    public short getInstance()

  Returns the instance part of the option record.

  Returns:
    The instance part of the record

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD