Examples of SharedByteArrayInputStream


Examples of javax.mail.util.SharedByteArrayInputStream

        ArrayList recipients = new ArrayList();
        recipients.add(new MailAddress("recipient@test.com"));
        MimeMessage mw = new MimeMessageCopyOnWriteProxy(
                new MimeMessageInputStreamSource(
                        "test",
                        new SharedByteArrayInputStream(
                                ("Return-path: return@test.com\r\n"+
                                 "Content-Transfer-Encoding: plain\r\n"+
                                 "Subject: test\r\n\r\n"+
                                 "Body Text\r\n").getBytes())));
        MailImpl m = new MailImpl("name", new MailAddress("from@test.com"),
                recipients, mw);
        mailRep.store(m);
        MimeMessage mw2 = new MimeMessageCopyOnWriteProxy(
                new MimeMessageInputStreamSource(
                        "test2",
                        new SharedByteArrayInputStream(
                                ("").getBytes())));
        MailImpl mailimpl2 = new MailImpl("name2", new MailAddress("from@test.com"),
                        recipients, mw2);
        mailRep.store(mailimpl2);
        m.dispose();
View Full Code Here

Examples of javax.mail.util.SharedByteArrayInputStream

    String body = "bar\r\n";

    protected MimeMessage getMessageFromSources(String sources) throws Exception {
        MimeMessageInputStreamSource mmis = null;
        try {
            mmis = new MimeMessageInputStreamSource("test", new SharedByteArrayInputStream(sources.getBytes()));
        } catch (MessagingException e) {
        }
        return new TestableMimeMessageWrapper(mmis);
    }
View Full Code Here

Examples of javax.mail.util.SharedByteArrayInputStream

    public LinearProcessorTest(String arg0) throws Exception {
        super(arg0);

        MimeMessageInputStreamSource mmis = null;
        try {
            mmis = new MimeMessageInputStreamSource("test", new SharedByteArrayInputStream((content+sep+body).getBytes()));
        } catch (MessagingException e) {
        }
        mw = new MimeMessageCopyOnWriteProxy(mmis);
        setUp();
  }
View Full Code Here

Examples of javax.mail.util.SharedByteArrayInputStream

import java.util.Properties;

public class MimeMessageFromSharedStreamTest extends MimeMessageFromStreamTest {
   
    protected MimeMessage getMessageFromSources(String sources) throws Exception {
        return new MimeMessage(Session.getDefaultInstance(new Properties()),new SharedByteArrayInputStream(sources.getBytes()));
    }
View Full Code Here

Examples of javax.mail.util.SharedByteArrayInputStream

    String body = "bar\r\n.\r\n";

    protected MimeMessage getMessageFromSources(String sources) throws Exception {
        MimeMessageInputStreamSource mmis = null;
        try {
            mmis = new MimeMessageInputStreamSource("test", new SharedByteArrayInputStream(sources.getBytes()));
        } catch (MessagingException e) {
        }
        return new MimeMessageCopyOnWriteProxy(mmis);
//        return new MimeMessage(Session.getDefaultInstance(new Properties()),new ByteArrayInputStream(sources.getBytes()));
    }
View Full Code Here

Examples of javax.mail.util.SharedByteArrayInputStream

        ArrayList recipients = new ArrayList();
        recipients.add(new MailAddress("recipient@test.com"));
        MimeMessageCopyOnWriteProxy mw = new MimeMessageCopyOnWriteProxy(
                new MimeMessageInputStreamSource(
                        "test",
                        new SharedByteArrayInputStream(
                                ("Return-path: return@test.com\r\n"+
                                 "Content-Transfer-Encoding: plain\r\n"+
                                 "Subject: test\r\n\r\n"+
                                 "Body Text\r\n").getBytes())));
       
View Full Code Here

Examples of javax.mail.util.SharedByteArrayInputStream

        ArrayList recipients = new ArrayList();
        recipients.add(new MailAddress("recipient@test.com"));
        MimeMessage mw = new MimeMessageCopyOnWriteProxy(
                new MimeMessageInputStreamSource(
                        "test",
                        new SharedByteArrayInputStream(
                                ("Return-path: return@test.com\r\n"+
                                 "Content-Transfer-Encoding: plain\r\n"+
                                 "Subject: test\r\n\r\n"+
                                 "Body Text\r\n").getBytes())));
        MailImpl m = new MailImpl("name", new MailAddress("from@test.com"),
                recipients, mw);
        mailRep.store(m);
        MimeMessage mw2 = new MimeMessageCopyOnWriteProxy(
                new MimeMessageInputStreamSource(
                        "test2",
                        new SharedByteArrayInputStream(
                                ("").getBytes())));
        MailImpl mailimpl2 = new MailImpl("name2", new MailAddress("from@test.com"),
                        recipients, mw2);
        mailRep.store(mailimpl2);
        m.dispose();
View Full Code Here

Examples of javax.mail.util.SharedByteArrayInputStream

            else
                bos = new ByteArrayOutputStream();
            try {
                original.writeTo(bos);
                bos.close();
                SharedByteArrayInputStream bis =
                        new SharedByteArrayInputStream(bos.toByteArray());
                parse(bis);
                bis.close();
                saved = true;
            } catch (IOException ex) {
                // should never happen, but just in case...
                throw new MessagingException("IOException while copying message",
                                ex);
View Full Code Here

Examples of javax.mail.util.SharedByteArrayInputStream

        this.internalDate = original.getInternalDate();
        this.size = original.getFullContentOctets();
        this.mailboxId = mailbox.getMailboxId();
        setFlags(original.createFlags());
        try {
            this.content = new SharedByteArrayInputStream(
                    IOUtils.toByteArray(original.getFullContent()));
        } catch (IOException e) {
            throw new MailboxException("Unable to parse message", e);
        }
View Full Code Here

Examples of javax.mail.util.SharedByteArrayInputStream

                new String(IOUtils.toByteArray(MESSAGE_SPECIAL_CHAR.getFullContent())));
    }

    private static SimpleMessage<Long> buildMessage(String content) {
        return new SimpleMessage<Long>(Calendar.getInstance().getTime(),
                content.length(), 0, new SharedByteArrayInputStream(
                        content.getBytes()), new Flags(),
                new PropertyBuilder(), 1L);
    }
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.