/** * @param os * @param verbose * @throws IOException * @since 3.0.0 */ public void viewFile(OutputStream os, boolean verbose) throws IOException { String indent=""; boolean withSizes = true; displayDirectory(getFs().getRoot(), os, indent, withSizes); if (verbose) { List strings = POIFSViewEngine.inspectViewable(fs, true, 0, " "); Iterator iter = strings.iterator(); while (iter.hasNext()) { os.write( ((String)iter.next()).getBytes()); } } }
public void initPOIFSFileSystem() throws IOException { if (getBuffer()!=null) { //fs = new POIFSFileSystem( org.docx4j.utils.BufferUtil.newInputStream(bb) ); // the above seems to be calling methods which aren't implemented, // so, for now, brute force.. log.info("initing POIFSFileSystem from existing data"); ByteArrayInputStream bais = new ByteArrayInputStream(this.getBytes()); fs = new POIFSFileSystem(bais); } else { log.info("creating new empty POIFSFileSystem"); fs = new POIFSFileSystem(); writePOIFSFileSystem(); } }
public OleObjectBinaryPart(PartName partName) throws InvalidFormatException { super(partName); init(); }
public void init() { // Used if this Part is added to [Content_Types].xml setContentType(new org.docx4j.openpackaging.contenttype.ContentType( org.docx4j.openpackaging.contenttype.ContentTypes.OFFICEDOCUMENT_OLE_OBJECT)); // should be this, unless it contains eg a doc stored directly (ie a non-generic OLE object) // Used when this Part is added to a rels setRelationshipType(Namespaces.OLE_OBJECT); }
/** * Write any changes which have been made to POIFSFileSystem, * to the underlying ByteBuffer. This is necessary if the changes * are to be persisted. * * @throws IOException */ public void writePOIFSFileSystem() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); getFs().writeFilesystem(baos); // Need to put this is bb byte[] bytes = baos.toByteArray(); // java.nio.ByteBuffer bb contains the data setBinaryData( ByteBuffer.wrap(bytes) ); }
OleObjectBinaryPart olePart = new OleObjectBinaryPart(new PartName(partName)); olePart.setContentType(new ContentType(contentType)); return olePart; } else if (contentType.equals(ContentTypes.OFFICEDOCUMENT_OLE_OBJECT) || contentType.equals(ContentTypes.OFFICEDOCUMENT_ACTIVEX_OBJECT)) { return new org.docx4j.openpackaging.parts.WordprocessingML.OleObjectBinaryPart(new PartName(partName)); } else if (contentType.equals(ContentTypes.OFFICEDOCUMENT_ACTIVEX_XML_OBJECT)) { return new org.docx4j.openpackaging.parts.ActiveXControlXmlPart(new PartName(partName));
public POIFSFileSystem getFs() throws IOException { if (fs==null) { initPOIFSFileSystem(); } return fs; }
Entry entry = it.next(); if (entry instanceof DirectoryNode) { displayDirectory((DirectoryNode) entry, os, newIndent, withSizes); } else { DocumentNode doc = (DocumentNode) entry;
public void init() { // Used if this Part is added to [Content_Types].xml setContentType(new org.docx4j.openpackaging.contenttype.ContentType( org.docx4j.openpackaging.contenttype.ContentTypes.OFFICEDOCUMENT_OLE_OBJECT)); // should be this, unless it contains eg a doc stored directly (ie a non-generic OLE object) // Used when this Part is added to a rels setRelationshipType(Namespaces.OLE_OBJECT); }
/** * Write any changes which have been made to POIFSFileSystem, * to the underlying ByteBuffer. This is necessary if the changes * are to be persisted. * * @throws IOException */ public void writePOIFSFileSystem() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); getFs().writeFilesystem(baos); // Need to put this is bb byte[] bytes = baos.toByteArray(); // java.nio.ByteBuffer bb contains the data setBinaryData( ByteBuffer.wrap(bytes) ); }
OleObjectBinaryPart olePart = new OleObjectBinaryPart(new PartName(partName)); olePart.setContentType(new ContentType(contentType)); return olePart; } else if (contentType.equals(ContentTypes.OFFICEDOCUMENT_OLE_OBJECT) || contentType.equals(ContentTypes.OFFICEDOCUMENT_ACTIVEX_OBJECT)) { return new org.docx4j.openpackaging.parts.WordprocessingML.OleObjectBinaryPart(new PartName(partName)); } else if (contentType.equals(ContentTypes.OFFICEDOCUMENT_ACTIVEX_XML_OBJECT)) { return new org.docx4j.openpackaging.parts.ActiveXControlXmlPart(new PartName(partName));
public POIFSFileSystem getFs() throws IOException { if (fs==null) { initPOIFSFileSystem(); } return fs; }
Entry entry = it.next(); if (entry instanceof DirectoryNode) { displayDirectory((DirectoryNode) entry, os, newIndent, withSizes); } else { DocumentNode doc = (DocumentNode) entry;
public void initPOIFSFileSystem() throws IOException { if (getBuffer()!=null) { //fs = new POIFSFileSystem( org.docx4j.utils.BufferUtil.newInputStream(bb) ); // the above seems to be calling methods which aren't implemented, // so, for now, brute force.. log.info("initing POIFSFileSystem from existing data"); ByteArrayInputStream bais = new ByteArrayInputStream(this.getBytes()); fs = new POIFSFileSystem(bais); } else { log.info("creating new empty POIFSFileSystem"); fs = new POIFSFileSystem(); writePOIFSFileSystem(); } }
/** * @param os * @param verbose * @throws IOException * @since 3.0.0 */ public void viewFile(OutputStream os, boolean verbose) throws IOException { String indent=""; boolean withSizes = true; displayDirectory(getFs().getRoot(), os, indent, withSizes); if (verbose) { List strings = POIFSViewEngine.inspectViewable(fs, true, 0, " "); Iterator iter = strings.iterator(); while (iter.hasNext()) { os.write( ((String)iter.next()).getBytes()); } } }
public OleObjectBinaryPart() throws InvalidFormatException { super( new PartName("/word/embeddings/oleObject1.bin") ); init(); }
public OleObjectBinaryPart(PartName partName) throws InvalidFormatException { super(partName); init(); }
public OleObjectBinaryPart() throws InvalidFormatException { super( new PartName("/word/embeddings/oleObject1.bin") ); init(); }