public void close() throws IOException { objectPart.clear(); try (final OutputStream os = objectPart.getOutputStream()) { final ByteArrayInputStream bis = new ByteArrayInputStream(this.buf, 0, size()); final FileMagic fm = FileMagic.valueOf(this.buf); if (fm == FileMagic.OLE2) { try (final POIFSFileSystem poifs = new POIFSFileSystem(bis)) { poifs.getRoot().setStorageClsid(metaData.getClassID()); poifs.writeFilesystem(os); } } else if (metaData.getOleEntry() == null) { // OLE Name hasn't been specified, pass the input through os.write(this.buf, 0, size()); } else { try (final POIFSFileSystem poifs = new POIFSFileSystem()) { final ClassID clsId = metaData.getClassID(); if (clsId != null) { poifs.getRoot().setStorageClsid(clsId); } poifs.createDocument(bis, metaData.getOleEntry()); Ole10Native.createOleMarkerEntry(poifs); poifs.writeFilesystem(os); } } } } }
try (final POIFSFileSystem poifs = new POIFSFileSystem(is)) { String[] names = { (app == null) ? null : app.getMetaData().getOleEntry(),
public void close() throws IOException { objectPart.clear(); try (final OutputStream os = objectPart.getOutputStream()) { final ByteArrayInputStream bis = new ByteArrayInputStream(this.buf, 0, size()); final FileMagic fm = FileMagic.valueOf(this.buf); if (fm == FileMagic.OLE2) { try (final POIFSFileSystem poifs = new POIFSFileSystem(bis)) { poifs.getRoot().setStorageClsid(metaData.getClassID()); poifs.writeFilesystem(os); } } else if (metaData.getOleEntry() == null) { // OLE Name hasn't been specified, pass the input through os.write(this.buf, 0, size()); } else { try (final POIFSFileSystem poifs = new POIFSFileSystem()) { final ClassID clsId = metaData.getClassID(); if (clsId != null) { poifs.getRoot().setStorageClsid(clsId); } poifs.createDocument(bis, metaData.getOleEntry()); Ole10Native.createOleMarkerEntry(poifs); poifs.writeFilesystem(os); } } } } }
try (final POIFSFileSystem poifs = new POIFSFileSystem(is)) { String[] names = { (app == null) ? null : app.getMetaData().getOleEntry(),
public void close() throws IOException { final FileMagic fm = FileMagic.valueOf(this.buf); final ByteArrayInputStream bis = new ByteArrayInputStream(this.buf, 0, this.count); final HSLFSlideShow ppt = getSheet().getSlideShow(); try (POIFSFileSystem poifs = (fm == FileMagic.OLE2) ? new POIFSFileSystem(bis) : new POIFSFileSystem()) { if (fm != FileMagic.OLE2) { poifs.createDocument(bis, md.getOleEntry()); } Ole10Native.createOleMarkerEntry(poifs); poifs.getRoot().setStorageClsid(md.getClassID()); int oid = getObjectID(); if (oid == 0) { // assign new embedding oid = ppt.addEmbed(poifs); setObjectID(oid); } else { final HSLFObjectData od = getObjectData(); if (od != null) { ByteArrayOutputStream bos = new ByteArrayOutputStream(this.size()+1000); poifs.writeFilesystem(bos); od.setData(bos.toByteArray()); } } setProgId(md.getProgId()); setFullName(md.getObjectName()); } } };