org.apache.poi.hslf.record
Class PersistPtrHolder

java.lang.Object
  extended by org.apache.poi.hslf.record.Record
      extended by org.apache.poi.hslf.record.RecordAtom
          extended by org.apache.poi.hslf.record.PositionDependentRecordAtom
              extended by org.apache.poi.hslf.record.PersistPtrHolder
All Implemented Interfaces:
PositionDependentRecord

public class PersistPtrHolder
extends PositionDependentRecordAtom

General holder for PersistPtrFullBlock and PersistPtrIncrementalBlock records. We need to handle them specially, since we have to go around updating UserEditAtoms if they shuffle about on disk These hold references to where slides "live". If the position of a slide moves, then we have update all of these. If we come up with a new version of a slide, then we have to add one of these to the end of the chain (via CurrentUserAtom and UserEditAtom) pointing to the new slide location

Author:
Nick Burch

Field Summary
 
Fields inherited from class org.apache.poi.hslf.record.PositionDependentRecordAtom
myLastOnDiskOffset
 
Fields inherited from class org.apache.poi.hslf.record.Record
logger
 
Constructor Summary
protected PersistPtrHolder(byte[] source, int start, int len)
          Create a new holder for a PersistPtr record
 
Method Summary
 void addSlideLookup(int slideID, int posOnDisk)
          Adds a new slide, notes or similar, to be looked up by this.
 int[] getKnownSlideIDs()
          Get the list of slides that this PersistPtrHolder knows about.
 long getRecordType()
          Return the value we were given at creation, be it 6001 or 6002
 java.util.Hashtable getSlideLocationsLookup()
          Get the lookup from slide numbers to byte offsets, for the slides known about by this PersistPtrHolder.
 java.util.Hashtable getSlideOffsetDataLocationsLookup()
          Get the lookup from slide numbers to their offsets inside _ptrData, used when adding or moving slides.
 void updateOtherRecordReferences(java.util.Hashtable oldToNewReferencesLookup)
          At write-out time, update the references to the sheets to their new positions
 void writeOut(java.io.OutputStream out)
          Write the contents of the record back, so it can be written to disk
 
Methods inherited from class org.apache.poi.hslf.record.PositionDependentRecordAtom
getLastOnDiskOffset, setLastOnDiskOffset
 
Methods inherited from class org.apache.poi.hslf.record.RecordAtom
getChildRecords, isAnAtom
 
Methods inherited from class org.apache.poi.hslf.record.Record
buildRecordAtOffset, createRecordForType, findChildRecords, writeLittleEndian, writeLittleEndian
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistPtrHolder

protected PersistPtrHolder(byte[] source,
                           int start,
                           int len)
Create a new holder for a PersistPtr record

Method Detail

getKnownSlideIDs

public int[] getKnownSlideIDs()
Get the list of slides that this PersistPtrHolder knows about. (They will be the keys in the hashtable for looking up the positions of these slides)


getSlideLocationsLookup

public java.util.Hashtable getSlideLocationsLookup()
Get the lookup from slide numbers to byte offsets, for the slides known about by this PersistPtrHolder.


getSlideOffsetDataLocationsLookup

public java.util.Hashtable getSlideOffsetDataLocationsLookup()
Get the lookup from slide numbers to their offsets inside _ptrData, used when adding or moving slides.


addSlideLookup

public void addSlideLookup(int slideID,
                           int posOnDisk)
Adds a new slide, notes or similar, to be looked up by this. For now, won't look for the most optimal on disk representation.


getRecordType

public long getRecordType()
Return the value we were given at creation, be it 6001 or 6002

Specified by:
getRecordType in class Record

updateOtherRecordReferences

public void updateOtherRecordReferences(java.util.Hashtable oldToNewReferencesLookup)
At write-out time, update the references to the sheets to their new positions

Specified by:
updateOtherRecordReferences in interface PositionDependentRecord
Specified by:
updateOtherRecordReferences in class PositionDependentRecordAtom

writeOut

public void writeOut(java.io.OutputStream out)
              throws java.io.IOException
Write the contents of the record back, so it can be written to disk

Specified by:
writeOut in class Record
Throws:
java.io.IOException


Copyright 2008 The Apache Software Foundation or its licensors, as applicable.