Package javax.mail.util

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


        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

            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

        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

                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

                List<Message<Long>> messages = new ArrayList<Message<Long>>();
                long i = start;
                while (i < calcEnd) {
                    long uid = i;
                    SimpleMessage<Long> m = new SimpleMessage<Long>(null, 0, 0, new SharedByteArrayInputStream(
                            "".getBytes()), new Flags(), new PropertyBuilder(), 1L);
                    m.setUid(uid);
                    messages.add(m);
                    i++;
                }
View Full Code Here

      bos = new ByteArrayOutputStream();
  try {
      strict = source.strict;
      source.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

     */
    protected InputStream getContentStream() throws MessagingException {
  if (contentStream != null)
      return ((SharedInputStream)contentStream).newStream(0, -1);
  if (content != null)
      return new SharedByteArrayInputStream(content);

  throw new MessagingException("No content");
    }
View Full Code Here

    public SharedByteArrayOutputStream(int size) {
  super(size);
    }

    public InputStream toStream() {
  return new SharedByteArrayInputStream(buf, 0, count);
    }
View Full Code Here

    public MimeMessageObjectMessageSource(ObjectMessage message) throws JMSException {
        this.message = message;
        this.id = message.getJMSMessageID();
        this.content = (byte[]) message.getObject();
        in = new SharedByteArrayInputStream(content);
    }
View Full Code Here

TOP

Related Classes of javax.mail.util.SharedByteArrayInputStream

Copyright © 2018 www.massapicom. 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.