Package javax.mail.util

Examples of javax.mail.util.SharedByteArrayInputStream


   */
  public void prepare(RawDocument rawDocument) throws RegainException {

    Properties mailProperties = System.getProperties();
    Session session = Session.getInstance(mailProperties, null);
    SharedByteArrayInputStream mimeInput = new SharedByteArrayInputStream(rawDocument.getContent());

    Collection<String> textParts = new ArrayList<String>();
    Collection<String> attachments = new ArrayList<String>();
    SimpleDateFormat simpleFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");

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

        setFlags(message.createFlags());
        this.uid = uid;
        this.modSeq = modSeq;
        this.logger = logger;
        try {
            this.content = new SharedByteArrayInputStream(IOUtils.toByteArray(ResultUtils.toInput(message)));
        } catch (IOException e) {
            throw new MailboxException("Unable to parse message",e);
        }
      
        this.bodyStartOctet = (int) (message.getFullContentOctets() - message.getBodyOctets());
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(ResultUtils.toInput(original)));
        } catch (IOException e) {
            throw new MailboxException("Unable to parse message",e);
        }
      
        this.bodyStartOctet = (int) (original.getFullContentOctets() - original.getBodyOctets());
View Full Code Here

     * @throws IOException
     */
    public JPAStreamingMessage(JPAMailbox mailbox, long uid, long modSeq, Message<?> message) throws MailboxException {
        super(mailbox, uid, modSeq, message);
        try {
            this.content = new SharedByteArrayInputStream(IOUtils.toByteArray(ResultUtils.toInput(message)));
            this.header = getHeaderContent();
            this.body = getBodyContent();
        } catch (IOException e) {
            throw new MailboxException("Unable to parse message",e);
        }
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

      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.