Examples of BodyFactory


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

            return result;
        }

        private BodyPart humanReadableTextBodyPart() {
            BodyPart result = new BodyPart();
            TextBody textBody = new BodyFactory().textBody(humanReadableText());
            result.setText(textBody);
            return result;
        }
View Full Code Here

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

        }

        private BodyPart deliveryStatusBodyPart() {
            BodyPart result = new BodyPart();
            TextBody textBody =
                    new BodyFactory().textBody(deliveryStatusText());
            result.setBody(textBody, "message/delivery-status");
            return result;
        }
View Full Code Here

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

        message.setTo(Mailbox.parse("Mary Smith <mary@example.net>"));
        message.setSubject("Saying Hello");

        // 3) set a text body

        BodyFactory bodyFactory = new BodyFactory();
        TextBody body = bodyFactory.textBody("This is a message just to "
                + "say hello.\r\nSo, \"Hello\".");

        // note that setText also sets the Content-Type header field
        message.setText(body);
View Full Code Here

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

        // a multipart may have a preamble
        multipart.setPreamble("This is a multi-part message in MIME format.");

        // first part is text/plain
        BodyFactory bodyFactory = new BodyFactory();
        BodyPart textPart = createTextPart(bodyFactory, "Why so serious?");
        multipart.addBodyPart(textPart);

        // second part is image/png (image is created on the fly)
        BufferedImage image = renderSampleImage();
View Full Code Here

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

    /**
     * Creates a text part from the specified string.
     */
    private static BodyPart createTextPart(String text) {
        TextBody body = new BodyFactory().textBody(text, "UTF-8");

        BodyPart bodyPart = new BodyPart();
        bodyPart.setText(body);
        bodyPart.setContentTransferEncoding("quoted-printable");

View Full Code Here

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

    private static BodyPart createRandomBinaryPart(int numberOfBytes)
            throws IOException {
        byte[] data = new byte[numberOfBytes];
        new Random().nextBytes(data);

        Body body = new BodyFactory()
                .binaryBody(new ByteArrayInputStream(data));

        BodyPart bodyPart = new BodyPart();
        bodyPart.setBody(body, "application/octet-stream");
        bodyPart.setContentTransferEncoding("base64");
View Full Code Here

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

            decodedStream = is;
         }

         try
         {
            BodyFactory factory = (BodyFactory)bodyFactoryField.get(this);
            body = factory.binaryBody(decodedStream);

            Stack<Object> st = (Stack<Object>)stackField.get(this);
            Entity entity = ((Entity) st.peek());
            entity.setBody(body);
         }
View Full Code Here

Examples of org.apache.qpid.framing.BodyFactory

        byte[] serverData = baos.toByteArray();
        ByteArrayDataInput badi = new ByteArrayDataInput(serverData);
        AMQDataBlockDecoder datablockDecoder = new AMQDataBlockDecoder();
        final MethodRegistry_0_91 methodRegistry_0_91 = new MethodRegistry_0_91();
        BodyFactory methodBodyFactory = new BodyFactory()
        {
            @Override
            public AMQBody createBody(final MarkableDataInput in, final long bodySize)
                    throws AMQFrameDecodingException, IOException
            {
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.