Package javax.mail.util

Examples of javax.mail.util.SharedByteArrayInputStream


     * @return a <code>BufferedInputStream</code> containing the data
     */
    public synchronized InputStream getInputStream() throws IOException {
        InputStream in;
        if (out.isInMemory()) {
            in = new SharedByteArrayInputStream(out.getData());
        } else {
            in = new SharedFileInputStream(out.getFile());
        }
        streams.add(in);
        return in;
View Full Code Here


                    } else {
                        bos = new ByteArrayOutputStream();
                    }
                    original.writeTo(bos);
                    bos.close();
                    in = new SharedByteArrayInputStream(bos.toByteArray());
                    parse(in);
                    in.close();
                    saved = true;
                } else {
                    MimeMessageInputStreamSource src = new MimeMessageInputStreamSource("MailCopy-" + UUID.randomUUID().toString());
View Full Code Here

    public void setUp() throws Exception {

        mailRepository = getMailRepository();
        MimeMessageInputStreamSource mmis = null;
        try {
            mmis = new MimeMessageInputStreamSource("test", new SharedByteArrayInputStream((content + sep + body).
                    getBytes()));
        } catch (MessagingException e) {
        }
        mimeMessage = new MimeMessageCopyOnWriteProxy(mmis);
        Collection<MailAddress> recipients = new ArrayList<MailAddress>();
View Full Code Here

  {   
    flush();
    if (this.thresholdReached)
      return new SharedTmpFileInputStream(this.outFile);
    else
      return new SharedByteArrayInputStream(this.buffer.array());
  }
View Full Code Here

    @Override
    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

public class MimeMessageFromSharedStreamTest extends MimeMessageFromStreamTest {

    @Override
    protected MimeMessage getMessageFromSources(String sources) throws Exception {
        return new MimeMessage(Session.getDefaultInstance(new Properties()), new SharedByteArrayInputStream(sources.getBytes()));
    }
View Full Code Here

    @Override
    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

    @Test
    public void testNPE1() throws MessagingException, InterruptedException {
        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 testNPE1\r\n").
                getBytes())));

        MimeMessageCopyOnWriteProxy mw2 = new MimeMessageCopyOnWriteProxy(mw);
        LifecycleUtil.dispose(mw2);
        mw2 = null;
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

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.