private byte[] getValue(Chunk chunk) { byte[] data = null; if (chunk instanceof ByteChunk) { data = ((ByteChunk) chunk).getValue(); } else if (chunk instanceof StringChunk) { data = ((StringChunk) chunk).getRawValue(); } return data; }
byte[] data = null; if (htmlChunk instanceof ByteChunk) { data = ((ByteChunk) htmlChunk).getValue(); } else if (htmlChunk instanceof StringChunk) { data = ((StringChunk) htmlChunk).getRawValue(); if (chunk.getValue() != null && chunk.getValue().length > 0) { MAPIRtfAttribute rtf = new MAPIRtfAttribute( MAPIProperty.RTF_COMPRESSED, Types.BINARY.getId(), chunk.getValue() ); Parser rtfParser =
/** * Returns the embedded object, if the attachment is an object based * embedding (image, document etc), or null if it's an embedded message */ public byte[] getEmbeddedAttachmentObject() { if (attachData != null) { return attachData.getValue(); } return null; }
TikaInputStream.get(attachment.getAttachData().getValue()), filename, null, null, xhtml, true
private byte[] getValue(Chunk chunk) { byte[] data = null; if (chunk instanceof ByteChunk) { data = ((ByteChunk) chunk).getValue(); } else if (chunk instanceof StringChunk) { data = ((StringChunk) chunk).getRawValue(); } return data; }
ByteChunk chunk = (ByteChunk) rtfChunk; MAPIRtfAttribute rtf = new MAPIRtfAttribute( MAPIProperty.RTF_COMPRESSED, Types.BINARY.getId(), chunk.getValue() );
/** * Gets the RTF Rich Message body of this Outlook Message, if this email * contains a RTF (rich) version. * @return The string representation of the 'RTF' version of the body, if available. * @throws ChunkNotFoundException */ public String getRtfBody() throws ChunkNotFoundException { ByteChunk chunk = mainChunks.rtfBodyChunk; if(chunk == null) { if(returnNullOnMissingChunk) { return null; } else { throw new ChunkNotFoundException(); } } try { MAPIRtfAttribute rtf = new MAPIRtfAttribute( MAPIProperty.RTF_COMPRESSED, Types.BINARY, chunk.getValue() ); return rtf.getDataString(); } catch(IOException e) { throw new RuntimeException("Shouldn't happen", e); } }
/** * Processes a single attachment: reads it from the Outlook MSG file and * writes it to disk as an individual file. * * @param attachment the chunk group describing the attachment * @param dir the directory in which to write the attachment file * @throws IOException when any of the file operations fails */ public void processAttachment(AttachmentChunks attachment, File dir) throws IOException { String fileName = attachment.getAttachFileName().toString(); if(attachment.getAttachLongFileName() != null) { fileName = attachment.getAttachLongFileName().toString(); } File f = new File(dir, fileName); OutputStream fileOut = null; try { fileOut = new FileOutputStream(f); fileOut.write(attachment.getAttachData().getValue()); } finally { if(fileOut != null) { fileOut.close(); } } }
for(AttachmentChunks attachment : msg.getAttachmentFiles()) { if(attachment.attachData != null) { byte[] data = attachment.attachData.getValue(); nonPOIFS.add( new ByteArrayInputStream(data) ); } else if(attachment.attachmentDirectory != null) {
/** * Gets the RTF Rich Message body of this Outlook Message, if this email * contains a RTF (rich) version. * @return The string representation of the 'RTF' version of the body, if available. * @throws ChunkNotFoundException If the rtf-body chunk does not exist and * returnNullOnMissingChunk is set */ public String getRtfBody() throws ChunkNotFoundException { ByteChunk chunk = mainChunks.getRtfBodyChunk(); if(chunk == null) { if(returnNullOnMissingChunk) { return null; } else { throw new ChunkNotFoundException(); } } try { MAPIRtfAttribute rtf = new MAPIRtfAttribute( MAPIProperty.RTF_COMPRESSED, Types.BINARY.getId(), chunk.getValue() ); return rtf.getDataString(); } catch(IOException e) { throw new RuntimeException("Shouldn't happen", e); } }
for (AttachmentChunks attachment : msg.getAttachmentFiles()) { if (attachment.getAttachData() != null) { byte[] data = attachment.getAttachData().getValue(); nonPOIFS.add( new ByteArrayInputStream(data) ); } else if (attachment.getAttachmentDirectory() != null) {
byte[] data = null; if (htmlChunk instanceof ByteChunk) { data = ((ByteChunk) htmlChunk).getValue(); } else if (htmlChunk instanceof StringChunk) { data = ((StringChunk) htmlChunk).getRawValue(); if (chunk.getValue() != null && chunk.getValue().length > 0) { MAPIRtfAttribute rtf = new MAPIRtfAttribute( MAPIProperty.RTF_COMPRESSED, Types.BINARY.getId(), chunk.getValue() ); Parser rtfParser =
byte[] data = null; if (htmlChunk instanceof ByteChunk) { data = ((ByteChunk) htmlChunk).getValue(); } else if (htmlChunk instanceof StringChunk) { data = ((StringChunk) htmlChunk).getRawValue(); if (chunk != null && chunk.getValue() != null && chunk.getValue().length > 0 && !doneBody) { MAPIProperty.RTF_COMPRESSED, Types.BINARY.getId(), chunk.getValue() ); Parser rtfParser = TikaInputStream.get(attachment.getAttachData().getValue()), filename, null, null, xhtml, true
TikaInputStream.get(attachment.getAttachData().getValue()), filename, null, null, xhtml, true
ByteChunk chunk = (ByteChunk) rtfChunk; MAPIRtfAttribute rtf = new MAPIRtfAttribute( MAPIProperty.RTF_COMPRESSED, Types.BINARY.getId(), chunk.getValue() );
byte[] data = null; if (htmlChunk instanceof ByteChunk) { data = ((ByteChunk) htmlChunk).getValue(); } else if (htmlChunk instanceof StringChunk) { data = ((StringChunk) htmlChunk).getRawValue(); ByteChunk chunk = (ByteChunk) rtfChunk; MAPIRtfAttribute rtf = new MAPIRtfAttribute( MAPIProperty.RTF_COMPRESSED, Types.BINARY.getId(), chunk.getValue() ); RTFParser rtfParser = new RTFParser(); TikaInputStream.get(attachment.getAttachData().getValue()), filename, null, null, xhtml, true