Package javax.mail.internet

Examples of javax.mail.internet.InternetHeaders$InternetHeader


    }

    public void writeOverview(PrintWriter prt) {
        try {
            FileInputStream fin = new FileInputStream(f);
            InternetHeaders hdr = new InternetHeaders(fin);
            fin.close();
            int articleNumber = getArticleNumber();
            String subject = hdr.getHeader("Subject",null);
            String author = hdr.getHeader("From",null);
            String date = hdr.getHeader("Date",null);
            String msgId = hdr.getHeader("Message-Id",null);
            String references = hdr.getHeader("References",null);
            long byteCount = f.length();
            long lineCount = -1;
            prt.print(articleNumber+"\t");
            prt.print((subject==null?"":subject)+"\t");
            prt.print((author==null?"":author)+"\t");
View Full Code Here


        } catch(Exception ex) { throw new NNTPException(ex); }
    }
    public String getHeader(String header) {
        try {
            FileInputStream fin = new FileInputStream(f);
            InternetHeaders hdr = new InternetHeaders(fin);
            fin.close();
            return hdr.getHeader(header,null);
        } catch(Exception ex) { throw new NNTPException(ex); }
    }
View Full Code Here

        ; // trivial implementation
    }

    protected InternetHeaders createInternetHeaders(InputStream inputStream)
            throws MessagingException {
        return new InternetHeaders();
    }
View Full Code Here

  }
 
  private Map<String, String> getHeaders(MultipartInputStream multipart) throws IOException, MessagingException {
    Map<String, String> mapHeaders = new HashMap<String, String>();
    moveToHeaders(multipart);
    InternetHeaders headers = new InternetHeaders(multipart);
   
    Enumeration<Header> allHeaders = headers.getAllHeaders();
    if (allHeaders != null) {
      while (allHeaders.hasMoreElements()) {
        Header header = allHeaders.nextElement();
        mapHeaders.put(header.getName().toLowerCase(), header.getValue());
      }
View Full Code Here

            if (!readTillFirstBoundary(stream, boundary)) {
                throw new IOException("Couldn't find MIME boundary: " + boundaryString);
            }

            try {
                message.put(InternetHeaders.class.getName(), new InternetHeaders(stream));
            } catch (MessagingException e) {
                throw new RuntimeException(e);
            }

            body = new DelegatingInputStream(new MimeBodyPartInputStream(stream, boundary, pbAmount));
View Full Code Here

            return null;
        }
        stream.unread(v);


        InternetHeaders headers;
        try {
            headers = new InternetHeaders(stream);
        } catch (MessagingException e) {
            // TODO create custom IOException
            throw new RuntimeException(e);
        }
View Full Code Here

          ByteArrayOutputStream os = new ByteArrayOutputStream();
          Writer writer = new OutputStreamWriter(MimeUtility.encode(os, "quoted-printable"),
              EncodingUtils.UTF8);
          writer.write(s);
          writer.close();
          InternetHeaders headers = new InternetHeaders();
          headers.setHeader("Content-Type", layout.getContentType() + "; charset=UTF-8");
          headers.setHeader("Content-Transfer-Encoding", "quoted-printable");
          part = new MimeBodyPart(headers, os.toByteArray());
        } catch (Exception ex) {
          StringBuilder contentBuilder = new StringBuilder(s);
          for (int i = 0; i < contentBuilder.length(); i++) {
            if (contentBuilder.charAt(i) >= 0x80) {
View Full Code Here

        }
    }

    public InternetHeaders getInternetHeadersUID(int uid, String user)
        throws AccessControlException, AuthorizationException {
        InternetHeaders response = null;
        if (sequence.contains(new Integer(uid))) {
            BufferedInputStream inMsg = null;
            try {
                inMsg = new BufferedInputStream( new FileInputStream(path + File.separator + uid + MESSAGE_EXTENSION));
                response = new InternetHeaders(inMsg);
                inMsg.close();
            } catch(Exception e) {
                getLogger().error("Error reading headers of message from disc: " + e);
                e.printStackTrace();
                throw new
View Full Code Here

     */
    public String getUniqueID() {
        FileInputStream fin = null;
        try {
            fin = new FileInputStream(articleFile);
            InternetHeaders headers = new InternetHeaders(fin);
            String[] idheader = headers.getHeader("Message-Id");
            return ( idheader.length > 0 ) ? idheader[0] : null;
        } catch(Exception ex) {
            throw new NNTPException(ex);
        } finally {
            IOUtil.shutdownStream(fin);
View Full Code Here

     * @see org.apache.james.nntpserver.repository.NNTPArticle#writeOverview(PrintWriter)
     */
    public void writeOverview(PrintWriter prt) {
        try {
            FileInputStream fin = new FileInputStream(articleFile);
            InternetHeaders hdr = new InternetHeaders(fin);
            fin.close();
            String subject = hdr.getHeader("Subject",null);
            String author = hdr.getHeader("From",null);
            String date = hdr.getHeader("Date",null);
            String msgId = hdr.getHeader("Message-Id",null);
            String references = hdr.getHeader("References",null);
            long byteCount = articleFile.length();
            // TODO: Address the line count issue.
            long lineCount = -1;
            StringBuffer line=new StringBuffer(256)
                .append(getArticleNumber())      .append("\t")
View Full Code Here

TOP

Related Classes of javax.mail.internet.InternetHeaders$InternetHeader

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.