import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.poifs.filesystem.DocumentInputStream;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* This holds the common functionality for all POI
* @author Nick Burch
*/
public abstract class POIDocument {
- // Holds metadata on our document
+ /** Holds metadata on our document */
protected SummaryInformation sInf;
+ /** Holds further metadata on our document */
protected DocumentSummaryInformation dsInf;
-
+ /** The open POIFS FileSystem that contains our document */
protected POIFSFileSystem filesystem;
+ /** For our own logging use */
+ protected POILogger logger = POILogFactory.getLogger(this.getClass());
+
+
/**
* Fetch the Document Summary Information of the document
*/
try {
MutablePropertySet mSet = new MutablePropertySet(set);
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
+
mSet.write(bOut);
byte[] data = bOut.toByteArray();
ByteArrayInputStream bIn = new ByteArrayInputStream(data);
outFS.createDocument(bIn,name);
- System.out.println("Wrote property set " + name + " of size " + data.length);
+
+ logger.log(POILogger.INFO, "Wrote property set " + name + " of size " + data.length);
} catch(org.apache.poi.hpsf.WritingNotSupportedException wnse) {
System.err.println("Couldn't write property set with name " + name + " as not supported by HPSF yet");
}
import org.apache.poi.hslf.record.PositionDependentRecord;
import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
import org.apache.poi.util.ArrayUtil;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* This class is a friendly wrapper on top of the more scary HSLFSlideShow.
private Notes[] _notes;
private FontCollection _fonts;
+ // For logging
+ private POILogger logger = POILogFactory.getLogger(this.getClass());
+
/* ===============================================================
* Setup Code
if(r instanceof org.apache.poi.hslf.record.Notes) {
notesRecords[i] = (org.apache.poi.hslf.record.Notes)r;
} else {
- System.err.println("A Notes SlideAtomSet at " + i + " said its record was at refID " + notesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
+ logger.log(POILogger.ERROR, "A Notes SlideAtomSet at " + i + " said its record was at refID " + notesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
}
// Record the match between slide id and these notes
System.arraycopy(_slides, 0, s, 0, _slides.length);
s[_slides.length] = slide;
_slides = s;
- System.out.println("Added slide " + _slides.length + " with ref " + sp.getRefID() + " and identifier " + sp.getSlideIdentifier());
+ logger.log(POILogger.INFO, "Added slide " + _slides.length + " with ref " + sp.getRefID() + " and identifier " + sp.getSlideIdentifier());
// Add the core records for this new Slide to the record tree
org.apache.poi.hslf.record.Slide slideRecord = slide.getSlideRecord();
// (Also need to tell it where it is)
slideRecord.setLastOnDiskOffset(slideOffset);
ptr.addSlideLookup(sp.getRefID(), slideOffset);
- System.out.println("New slide ended up at " + slideOffset);
+ logger.log(POILogger.INFO, "New slide ended up at " + slideOffset);
// Last view is now of the slide
usr.setLastViewType((short)UserEditAtom.LAST_VIEW_SLIDE_VIEW);