Package org.apache.poi.hslf.record
Class Record
- java.lang.Object
-
- org.apache.poi.hslf.record.Record
-
- All Implemented Interfaces:
GenericRecord
- Direct Known Subclasses:
RecordAtom,RecordContainer
public abstract class Record extends java.lang.Object implements GenericRecord
This abstract class represents a record in the PowerPoint document. Record classes should extend with RecordContainer or RecordAtom, which extend this in turn.
-
-
Constructor Summary
Constructors Constructor Description Record()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static RecordbuildRecordAtOffset(byte[] b, int offset)Build and return the Record at the given offset.static RecordcreateRecordForType(long type, byte[] b, int start, int len)For a given type (little endian bytes 3 and 4 in record header), byte array, start position and length: will return a Record object that will handle that record Remember that while PPT stores the record lengths as 8 bytes short (not including the size of the header), this code assumes you're passing in corrected lengthsstatic Record[]findChildRecords(byte[] b, int start, int len)Default method for finding child records of a container recordabstract Record[]getChildRecords()Fetch all the child records of this record If this record is an atom, will return null If this record is a non-atom, but has no children, will return an empty arrayjava.util.List<Record>getGenericChildren()java.lang.EnumgetGenericRecordType()abstract longgetRecordType()Returns the type (held as a little endian in bytes 3 and 4) that this class handlesabstract booleanisAnAtom()Is this record type an Atom record (only has data), or is it a non-Atom record (has other records)?static voidwriteLittleEndian(int i, java.io.OutputStream o)When writing out, write out a signed int (32bit) in Little Endian formatstatic voidwriteLittleEndian(short s, java.io.OutputStream o)When writing out, write out a signed short (16bit) in Little Endian formatabstract voidwriteOut(java.io.OutputStream o)Have the contents printer out into an OutputStream, used when writing a file back out to disk (Normally, atom classes will keep their bytes around, but non atom classes will just request the bytes from their children, then chuck on their header and return)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericProperties
-
-
-
-
Method Detail
-
isAnAtom
public abstract boolean isAnAtom()
Is this record type an Atom record (only has data), or is it a non-Atom record (has other records)?
-
getRecordType
public abstract long getRecordType()
Returns the type (held as a little endian in bytes 3 and 4) that this class handles
-
getChildRecords
public abstract Record[] getChildRecords()
Fetch all the child records of this record If this record is an atom, will return null If this record is a non-atom, but has no children, will return an empty array
-
writeOut
public abstract void writeOut(java.io.OutputStream o) throws java.io.IOExceptionHave the contents printer out into an OutputStream, used when writing a file back out to disk (Normally, atom classes will keep their bytes around, but non atom classes will just request the bytes from their children, then chuck on their header and return)- Throws:
java.io.IOException
-
getGenericRecordType
public java.lang.Enum getGenericRecordType()
- Specified by:
getGenericRecordTypein interfaceGenericRecord
-
getGenericChildren
public java.util.List<Record> getGenericChildren()
- Specified by:
getGenericChildrenin interfaceGenericRecord
-
writeLittleEndian
public static void writeLittleEndian(int i, java.io.OutputStream o) throws java.io.IOExceptionWhen writing out, write out a signed int (32bit) in Little Endian format- Throws:
java.io.IOException
-
writeLittleEndian
public static void writeLittleEndian(short s, java.io.OutputStream o) throws java.io.IOExceptionWhen writing out, write out a signed short (16bit) in Little Endian format- Throws:
java.io.IOException
-
buildRecordAtOffset
public static Record buildRecordAtOffset(byte[] b, int offset)
Build and return the Record at the given offset. Note - does less error checking and handling than findChildRecords- Parameters:
b- The byte array to build fromoffset- The offset to build at
-
findChildRecords
public static Record[] findChildRecords(byte[] b, int start, int len)
Default method for finding child records of a container record
-
createRecordForType
public static Record createRecordForType(long type, byte[] b, int start, int len)
For a given type (little endian bytes 3 and 4 in record header), byte array, start position and length: will return a Record object that will handle that record Remember that while PPT stores the record lengths as 8 bytes short (not including the size of the header), this code assumes you're passing in corrected lengths
-
-