/** Get the image data of the buffer * * @param binaryPart * @return */ protected byte[] getImageData(BinaryPart binaryPart) { return binaryPart.getBytes(); }
protected void saveRawBinaryPart(ZipOutputStream out, Part part) throws Docx4JException { // Drop the leading '/' String resolvedPartUri = part.getPartName().getName().substring(1); try { // Add ZIP entry to output stream. out.putNextEntry(new ZipEntry(resolvedPartUri)); out.write( ((BinaryPart)part).getBytes() ); // Complete the entry out.closeEntry(); } catch (Exception e ) { throw new Docx4JException("Failed to put binary part", e); } log.info( "success writing part: " + resolvedPartUri); }
fos.write( ((BinaryPart)part).getBytes() ); fos.close();
} else if (part instanceof BinaryPart) { log.debug("getting bytes..."); return ((BinaryPart)part).getBytes(); } else { log.error("Part was a " + part.getClass().getName());
public static org.docx4j.xmlPackage.Part createRawBinaryPart(Part part) throws Docx4JException { String resolvedPartUri = part.getPartName().getName(); // Don't drop leading "/" for XmlPackage representation. // It is needed if Word is to consume the result. //String resolvedPartUri = part.getPartName().getName().substring(1); org.docx4j.xmlPackage.Part partResult = factory.createPart(); partResult.setName(resolvedPartUri); partResult.setContentType( part.getContentType() ); try { partResult.setCompression("store"); partResult.setBinaryData( ((BinaryPart)part).getBytes() ); } catch (Exception e ) { throw new Docx4JException("Failed to put binary part", e); } log.debug( "PUT SUCCESS: " + resolvedPartUri); return partResult; }
bytes = ((BinaryPart)part).getBytes();
/** Get the image data of the buffer * * @param binaryPart * @return */ protected byte[] getImageData(BinaryPart binaryPart) { return binaryPart.getBytes(); }
protected void saveRawBinaryPart(ZipOutputStream out, Part part) throws Docx4JException { // Drop the leading '/' String resolvedPartUri = part.getPartName().getName().substring(1); try { // Add ZIP entry to output stream. out.putNextEntry(new ZipEntry(resolvedPartUri)); out.write( ((BinaryPart)part).getBytes() ); // Complete the entry out.closeEntry(); } catch (Exception e ) { throw new Docx4JException("Failed to put binary part", e); } log.info( "success writing part: " + resolvedPartUri); }
fos.write( ((BinaryPart)part).getBytes() ); fos.close();
public static org.docx4j.xmlPackage.Part createRawBinaryPart(Part part) throws Docx4JException { String resolvedPartUri = part.getPartName().getName(); // Don't drop leading "/" for XmlPackage representation. // It is needed if Word is to consume the result. //String resolvedPartUri = part.getPartName().getName().substring(1); org.docx4j.xmlPackage.Part partResult = factory.createPart(); partResult.setName(resolvedPartUri); partResult.setContentType( part.getContentType() ); try { partResult.setCompression("store"); partResult.setBinaryData( ((BinaryPart)part).getBytes() ); } catch (Exception e ) { throw new Docx4JException("Failed to put binary part", e); } log.debug( "PUT SUCCESS: " + resolvedPartUri); return partResult; }
} else if (part instanceof BinaryPart) { log.debug("getting bytes..."); return ((BinaryPart)part).getBytes(); } else { log.error("Part was a " + part.getClass().getName());
bytes = ((BinaryPart)part).getBytes();