Package org.apache.poi.hslf.usermodel
Class HSLFSlideShowImpl
- java.lang.Object
 - 
- org.apache.poi.POIDocument
 - 
- org.apache.poi.hslf.usermodel.HSLFSlideShowImpl
 
 
 
- 
- All Implemented Interfaces:
 java.io.Closeable,java.lang.AutoCloseable
public final class HSLFSlideShowImpl extends POIDocument implements java.io.Closeable
This class contains the main functionality for the Powerpoint file "reader". It is only a very basic class for now 
- 
- 
Constructor Summary
Constructors Constructor Description HSLFSlideShowImpl(java.io.InputStream inputStream)Constructs a Powerpoint document from an input stream.HSLFSlideShowImpl(java.lang.String fileName)Constructs a Powerpoint document from fileName.HSLFSlideShowImpl(DirectoryNode dir)Constructs a Powerpoint document from a specific point in a POIFS Filesystem.HSLFSlideShowImpl(POIFSFileSystem filesystem)Constructs a Powerpoint document from a POIFS Filesystem. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddPicture(HSLFPictureData img)Add a new picture to this presentation.intappendRootLevelRecord(Record newRecord)Adds a new root level record, at the end, but before the last PersistPtrIncrementalBlock.voidclose()Closes the underlyingPOIFSFileSystemfrom which the document was read, if any.static HSLFSlideShowImplcreate()Constructs a new, empty, Powerpoint document.CurrentUserAtomgetCurrentUserAtom()Fetch the Current User Atom of the documentDocumentEncryptionAtomgetDocumentEncryptionAtom()HSLFObjectData[]getEmbeddedObjects()Gets embedded object data from the slide show.EncryptionInfogetEncryptionInfo()java.util.List<HSLFPictureData>getPictureData()Return list of pictures contained in this presentationRecord[]getRecords()Returns an array of all the records found in the slideshowbyte[]getUnderlyingBytes()Returns an array of the bytes of the file.voidnormalizeRecords()remove duplicated UserEditAtoms and merge PersistPtrHolder, i.e.voidupdateAndWriteDependantRecords(java.io.OutputStream os, java.util.Map<RecordTypes,PositionDependentRecord> interestingRecords)This is a helper functions, which is needed for adding new position dependent records or finally write the slideshow to a file.voidwrite()Writes out the slideshow to the currently open file.voidwrite(java.io.File newFile)Writes out the slideshow file the is represented by an instance of this class.voidwrite(java.io.File newFile, boolean preserveNodes)Writes out the slideshow file the is represented by an instance of this class.voidwrite(java.io.OutputStream out)Writes out the slideshow file the is represented by an instance of this class.voidwrite(java.io.OutputStream out, boolean preserveNodes)Writes out the slideshow file the is represented by an instance of this class.- 
Methods inherited from class org.apache.poi.POIDocument
createInformationProperties, getDirectory, getDocumentSummaryInformation, getSummaryInformation 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
HSLFSlideShowImpl
public HSLFSlideShowImpl(java.lang.String fileName) throws java.io.IOExceptionConstructs a Powerpoint document from fileName. Parses the document and places all the important stuff into data structures.- Parameters:
 fileName- The name of the file to read.- Throws:
 java.io.IOException- if there is a problem while parsing the document.
 
- 
HSLFSlideShowImpl
public HSLFSlideShowImpl(java.io.InputStream inputStream) throws java.io.IOExceptionConstructs a Powerpoint document from an input stream. Parses the document and places all the important stuff into data structures.- Parameters:
 inputStream- the source of the data- Throws:
 java.io.IOException- if there is a problem while parsing the document.
 
- 
HSLFSlideShowImpl
public HSLFSlideShowImpl(POIFSFileSystem filesystem) throws java.io.IOException
Constructs a Powerpoint document from a POIFS Filesystem. Parses the document and places all the important stuff into data structures.- Parameters:
 filesystem- the POIFS FileSystem to read from- Throws:
 java.io.IOException- if there is a problem while parsing the document.
 
- 
HSLFSlideShowImpl
public HSLFSlideShowImpl(DirectoryNode dir) throws java.io.IOException
Constructs a Powerpoint document from a specific point in a POIFS Filesystem. Parses the document and places all the important stuff into data structures.- Parameters:
 dir- the POIFS directory to read from- Throws:
 java.io.IOException- if there is a problem while parsing the document.
 
 - 
 
- 
Method Detail
- 
create
public static HSLFSlideShowImpl create()
Constructs a new, empty, Powerpoint document. 
- 
getDocumentEncryptionAtom
public DocumentEncryptionAtom getDocumentEncryptionAtom()
 
- 
normalizeRecords
public void normalizeRecords()
remove duplicated UserEditAtoms and merge PersistPtrHolder, i.e. remove document edit history 
- 
updateAndWriteDependantRecords
public void updateAndWriteDependantRecords(java.io.OutputStream os, java.util.Map<RecordTypes,PositionDependentRecord> interestingRecords) throws java.io.IOExceptionThis is a helper functions, which is needed for adding new position dependent records or finally write the slideshow to a file.- Parameters:
 os- the stream to write to, if null only the references are updatedinterestingRecords- a map of interesting records (PersistPtrHolder and UserEditAtom) referenced by their RecordType. Only the very last of each type will be saved to the map. May be null, if not needed.- Throws:
 java.io.IOException
 
- 
write
public void write() throws java.io.IOExceptionWrites out the slideshow to the currently open file.This will fail (with an
IllegalStateExceptionif the slideshow was opened read-only, opened from anInputStreaminstead of a File, or if this is not the root document. For those cases, you must usewrite(OutputStream)orwrite(File)to write to a brand new document.- Specified by:
 writein classPOIDocument- Throws:
 java.io.IOException- thrown on errors writing to the filejava.lang.IllegalStateException- if this isn't from a writable File- Since:
 - POI 3.15 beta 3
 
 
- 
write
public void write(java.io.File newFile) throws java.io.IOExceptionWrites out the slideshow file the is represented by an instance of this class.This will write out only the common OLE2 streams. If you require all streams to be written out, use
write(File, boolean)withpreserveNodesset totrue.- Specified by:
 writein classPOIDocument- Parameters:
 newFile- The File to write to.- Throws:
 java.io.IOException- If there is an unexpected IOException from writing to the File
 
- 
write
public void write(java.io.File newFile, boolean preserveNodes) throws java.io.IOExceptionWrites out the slideshow file the is represented by an instance of this class. If you require all streams to be written out (eg Marcos, embeded documents), then setpreserveNodesset totrue- Parameters:
 newFile- The File to write to.preserveNodes- Should all OLE2 streams be written back out, or only the common ones?- Throws:
 java.io.IOException- If there is an unexpected IOException from writing to the File
 
- 
write
public void write(java.io.OutputStream out) throws java.io.IOExceptionWrites out the slideshow file the is represented by an instance of this class.This will write out only the common OLE2 streams. If you require all streams to be written out, use
write(OutputStream, boolean)withpreserveNodesset totrue.- Specified by:
 writein classPOIDocument- Parameters:
 out- The OutputStream to write to.- Throws:
 java.io.IOException- If there is an unexpected IOException from the passed in OutputStream
 
- 
write
public void write(java.io.OutputStream out, boolean preserveNodes) throws java.io.IOExceptionWrites out the slideshow file the is represented by an instance of this class. If you require all streams to be written out (eg Marcos, embeded documents), then setpreserveNodesset totrue- Parameters:
 out- The OutputStream to write to.preserveNodes- Should all OLE2 streams be written back out, or only the common ones?- Throws:
 java.io.IOException- If there is an unexpected IOException from the passed in OutputStream
 
- 
getEncryptionInfo
public EncryptionInfo getEncryptionInfo()
- Overrides:
 getEncryptionInfoin classPOIDocument- Returns:
 - the encryption info if the document is encrypted, otherwise 
null 
 
- 
appendRootLevelRecord
public int appendRootLevelRecord(Record newRecord)
Adds a new root level record, at the end, but before the last PersistPtrIncrementalBlock. 
- 
addPicture
public int addPicture(HSLFPictureData img)
Add a new picture to this presentation.- Returns:
 - offset of this picture in the Pictures stream
 
 
- 
getRecords
public Record[] getRecords()
Returns an array of all the records found in the slideshow 
- 
getUnderlyingBytes
public byte[] getUnderlyingBytes()
Returns an array of the bytes of the file. Only correct after a call to open or write - at all other times might be wrong! 
- 
getCurrentUserAtom
public CurrentUserAtom getCurrentUserAtom()
Fetch the Current User Atom of the document 
- 
getPictureData
public java.util.List<HSLFPictureData> getPictureData()
Return list of pictures contained in this presentation- Returns:
 - list with the read pictures or an empty list if the presentation doesn't contain pictures.
 
 
- 
getEmbeddedObjects
public HSLFObjectData[] getEmbeddedObjects()
Gets embedded object data from the slide show.- Returns:
 - the embedded objects.
 
 
- 
close
public void close() throws java.io.IOExceptionDescription copied from class:POIDocumentCloses the underlyingPOIFSFileSystemfrom which the document was read, if any. Has no effect on documents opened from an InputStream, or newly created ones.Once
close()has been called, no further operations should be called on the document.- Specified by:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable- Overrides:
 closein classPOIDocument- Throws:
 java.io.IOException
 
 - 
 
 -