Examples of BinaryBody


Examples of com.vtence.molecule.lib.BinaryBody

            response.set(ETAG, "\"" + Hex.from(computeHash(output)) + "\"");
        }
        if (!hasCachingDirective(response)) {
            response.set(CACHE_CONTROL, REVALIDATE);
        }
        response.body(new BinaryBody(output));
    }
View Full Code Here

Examples of org.apache.james.mime4j.dom.BinaryBody

        }
        assertEquals("Message contains more attachments", attachmentsMsg.poll(), null);
    }

    private String getBinPart(Entity part) throws IOException {
        BinaryBody bb = (BinaryBody) part.getBody();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bb.writeTo(baos);
        return new String(baos.toByteArray());
    }
View Full Code Here

Examples of org.apache.james.mime4j.dom.BinaryBody

            } else if (o instanceof BinaryBody){
                /*
                 * A binary body. Display its MIME type and length in bytes.
                 */
                BinaryBody body = (BinaryBody) o;
                int size = 0;
                try {
                    InputStream is = body.getInputStream();
                    while ((is.read()) != -1) {
                        size++;
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                textView.setText("Binary body\n"
                               + "MIME type: "
                                   + body.getParent().getMimeType() + "\n"
                               + "Size of decoded data: " + size + " bytes");

            } else if (o instanceof ContentTypeField) {
                /*
                 * Content-Type field.
View Full Code Here

Examples of org.apache.james.mime4j.dom.BinaryBody

    private static BodyPart createImagePart(StorageBodyFactory bodyFactory,
            BufferedImage image) throws IOException {
        // Create a binary message body from the image
        StorageProvider storageProvider = bodyFactory.getStorageProvider();
        Storage storage = storeImage(storageProvider, image, "png");
        BinaryBody body = bodyFactory.binaryBody(storage);

        // Create a body part with the correct MIME-type and transfer encoding
        BodyPart bodyPart = new BodyPart();
        bodyPart.setBody(body, "image/png");
        bodyPart.setContentTransferEncoding("base64");
View Full Code Here

Examples of org.apache.james.mime4j.dom.BinaryBody

        }
       
        String uniqueFilename = filename + "-" + email.getSentDate();
        String outPath = outputDirPath + uniqueFilename;
        FileOutputStream fos;
        BinaryBody bb;
        try {
            fos = new FileOutputStream(outPath);
        } catch (FileNotFoundException ex) {
            addErrorMessage(
                    NbBundle.getMessage(this.getClass(),
                                        "MboxParser.handleAttch.errMsg.failedToCreateOnDisk", outPath));
            logger.log(Level.INFO, "Failed to create file output stream for: " + outPath, ex); //NON-NLS
            return;
        }
       
        try {
            Body b = e.getBody();
            if (b instanceof BinaryBody) {
                bb = (BinaryBody) b;
                bb.writeTo(fos);
            } else {
                // This could potentially be other types. Only seen this once.
            }
        } catch (IOException ex) {
            logger.log(Level.INFO, "Failed to write mbox email attachment to disk.", ex); //NON-NLS
View Full Code Here

Examples of org.apache.james.mime4j.message.BinaryBody

            }
            return "smtp; " + buffer.toString();
        }

        private BodyPart originalMessageBodyPart() {
            BinaryBody body = new MessageContentBody(originalMail.mailData);
            BodyPart result = new BodyPart();
            result.setBody(body, "message/rfc822");
            return result;
        }
View Full Code Here

Examples of org.apache.james.mime4j.message.BinaryBody

    private static BodyPart createImagePart(BodyFactory bodyFactory,
            BufferedImage image) throws IOException {
        // Create a binary message body from the image
        StorageProvider storageProvider = bodyFactory.getStorageProvider();
        Storage storage = storeImage(storageProvider, image, "png");
        BinaryBody body = bodyFactory.binaryBody(storage);

        // Create a body part with the correct MIME-type and transfer encoding
        BodyPart bodyPart = new BodyPart();
        bodyPart.setBody(body, "image/png");
        bodyPart.setContentTransferEncoding("base64");
View Full Code Here

Examples of org.apache.james.mime4j.message.BinaryBody

               
            } else if (o instanceof BinaryBody){
                /*
                 * A binary body. Display its MIME type and length in bytes.
                 */
                BinaryBody body = (BinaryBody) o;
                int size = 0;
                try {
                    InputStream is = body.getInputStream();
                    while ((is.read()) != -1) {
                        size++;
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                textView.setText("Binary body\n"
                               + "MIME type: "
                                   + body.getParent().getMimeType() + "\n"
                               + "Size of decoded data: " + size + " bytes");
               
            } else if (o instanceof ContentTypeField) {
                /*
                 * Content-Type field.
View Full Code Here

Examples of org.apache.james.mime4j.message.BinaryBody

               
            } else if (o instanceof BinaryBody){
                /*
                 * A binary body. Display its MIME type and length in bytes.
                 */
                BinaryBody body = (BinaryBody) o;
                int size = 0;
                try {
                    InputStream is = body.getInputStream();
                    while ((is.read()) != -1) {
                        size++;
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                textView.setText("Binary body\n"
                               + "MIME type: "
                                   + body.getParent().getMimeType() + "\n"
                               + "Size of decoded data: " + size + " bytes");
               
            } else if (o instanceof ContentTypeField) {
                /*
                 * Content-Type field.
View Full Code Here

Examples of org.mime4j.message.BinaryBody

               
            } else if (o instanceof BinaryBody){
                /*
                 * A binary body. Display its MIME type and length in bytes.
                 */
                BinaryBody body = (BinaryBody) o;
                int size = 0;
                try {
                    InputStream is = body.getInputStream();
                    int b;
                    while ((b = is.read()) != -1) {
                        size++;
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                textView.setText("Binary body\n"
                               + "MIME type: "
                                   + body.getParent().getMimeType() + "\n"
                               + "Size of decoded data: " + size + " bytes");
               
            } else if (o instanceof ContentTypeField) {
                /*
                 * Content-Type field.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.