org.apache.poi.ddf
Class DefaultEscherRecordFactory

java.lang.Object
  extended by org.apache.poi.ddf.DefaultEscherRecordFactory
All Implemented Interfaces:
EscherRecordFactory

public class DefaultEscherRecordFactory
extends java.lang.Object
implements EscherRecordFactory

Generates escher records when provided the byte array containing those records.

See Also:
EscherRecordFactory

Constructor Summary
DefaultEscherRecordFactory()
          Creates an instance of the escher record factory
 
Method Summary
 EscherRecord createRecord(byte[] data, int offset)
          Generates an escher record including any children contained under that record.
static boolean isContainer(short options, short recordId)
           
protected static java.util.Map<java.lang.Short,java.lang.reflect.Constructor<? extends EscherRecord>> recordsToMap(java.lang.Class<?>[] recClasses)
          Converts from a list of classes into a map that contains the record id as the key and the Constructor in the value part of the map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEscherRecordFactory

public DefaultEscherRecordFactory()
Creates an instance of the escher record factory

Method Detail

createRecord

public EscherRecord createRecord(byte[] data,
                                 int offset)
Description copied from interface: EscherRecordFactory
Generates an escher record including any children contained under that record. An exception is thrown if the record could not be generated.

Specified by:
createRecord in interface EscherRecordFactory
Parameters:
data - The byte array containing the records
offset - The starting offset into the byte array
Returns:
The generated escher record

recordsToMap

protected static java.util.Map<java.lang.Short,java.lang.reflect.Constructor<? extends EscherRecord>> recordsToMap(java.lang.Class<?>[] recClasses)
Converts from a list of classes into a map that contains the record id as the key and the Constructor in the value part of the map. It does this by using reflection to look up the RECORD_ID field then using reflection again to find a reference to the constructor.

Parameters:
recClasses - The records to convert
Returns:
The map containing the id/constructor pairs.

isContainer

public static boolean isContainer(short options,
                                  short recordId)