Example #1
0
  @Override
  public MimeHeader clone() {
    MimeHeader header = new MimeHeader();
    header.mCharset = mCharset;

    header.mFields = new ArrayList<Field>(mFields);

    return header;
  }
Example #2
0
  protected void parse(InputStream in) throws IOException, MessagingException {
    mHeader.clear();
    mFrom = null;
    mTo = null;
    mCc = null;
    mBcc = null;
    mReplyTo = null;

    mMessageId = null;
    mReferences = null;
    mInReplyTo = null;

    mSentDate = null;

    mBody = null;

    MimeEntityConfig parserConfig = new MimeEntityConfig();
    parserConfig.setMaxHeaderLen(-1); // The default is a mere 10k
    parserConfig.setMaxLineLen(-1); // The default is 1000 characters. Some MUAs generate
    // REALLY long References: headers
    MimeStreamParser parser = new MimeStreamParser(parserConfig);
    parser.setContentHandler(new MimeMessageBuilder());
    try {
      parser.parse(new EOLConvertingInputStream(in));
    } catch (MimeException me) {
      throw new Error(me);
    }
  }
Example #3
0
  public void writeTo(OutputStream out) throws IOException, MessagingException {

    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
    mHeader.writeTo(out);
    writer.write("\r\n");
    writer.flush();
    if (mBody != null) {
      mBody.writeTo(out);
    }
  }
Example #4
0
 @Override
 public Set<String> getHeaderNames() throws UnavailableStorageException {
   return mHeader.getHeaderNames();
 }
Example #5
0
 @Override
 public void removeHeader(String name) throws UnavailableStorageException {
   mHeader.removeHeader(name);
 }
Example #6
0
 @Override
 public String[] getHeader(String name) throws UnavailableStorageException {
   return mHeader.getHeader(name);
 }
Example #7
0
 @Override
 public void setHeader(String name, String value) throws UnavailableStorageException {
   mHeader.setHeader(name, value);
 }
Example #8
0
 protected String getFirstHeader(String name) {
   return mHeader.getFirstHeader(name);
 }
 @Override
 public void removeHeader(String name) throws MessagingException {
   mHeader.removeHeader(name);
 }
 @NonNull
 @Override
 public String[] getHeader(String name) throws MessagingException {
   return mHeader.getHeader(name);
 }
 @Override
 public void setHeader(String name, String value) {
   mHeader.setHeader(name, value);
 }
 @Override
 public void addRawHeader(String name, String raw) {
   mHeader.addRawHeader(name, raw);
 }
 @Override
 public void addHeader(String name, String value) throws MessagingException {
   mHeader.addHeader(name, value);
 }
 private String getFirstHeader(String name) {
   return mHeader.getFirstHeader(name);
 }
 @Override
 public void writeHeaderTo(OutputStream out) throws IOException, MessagingException {
   mHeader.writeTo(out);
 }