/** * Parse the given sequence of addresses into InternetAddress * objects. If <code>strict</code> is false, the full syntax rules for * individual addresses are not enforced. If <code>strict</code> is * true, many (but not all) of the RFC822 syntax rules are enforced. <p> * * To better support the range of "invalid" addresses seen in real * messages, this method enforces fewer syntax rules than the * <code>parse</code> method when the strict flag is false * and enforces more rules when the strict flag is true. If the * strict flag is false and the parse is successful in separating out an * email address or addresses, the syntax of the addresses themselves * is not checked. * * @param addresslist comma separated address strings * @param strict enforce RFC822 syntax * @return array of InternetAddress objects * @exception AddressException if the parse failed * @since JavaMail 1.3 */ public static InternetAddress[] parseHeader(String addresslist, boolean strict) throws AddressException { return parse(MimeUtility.unfold(addresslist), strict, true); }
/** * Parse the given sequence of addresses into InternetAddress * objects. If <code>strict</code> is false, the full syntax rules for * individual addresses are not enforced. If <code>strict</code> is * true, many (but not all) of the RFC822 syntax rules are enforced. <p> * * To better support the range of "invalid" addresses seen in real * messages, this method enforces fewer syntax rules than the * <code>parse</code> method when the strict flag is false * and enforces more rules when the strict flag is true. If the * strict flag is false and the parse is successful in separating out an * email address or addresses, the syntax of the addresses themselves * is not checked. * * @param addresslist comma separated address strings * @param strict enforce RFC822 syntax * @return array of InternetAddress objects * @exception AddressException if the parse failed * @since JavaMail 1.3 */ public static InternetAddress[] parseHeader(String addresslist, boolean strict) throws AddressException { return parse(MimeUtility.unfold(addresslist), strict, true); }
static String getDescription(MimePart part) throws MessagingException { String rawvalue = part.getHeader("Content-Description", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
static String getDescription(MimePart part) throws MessagingException { String rawvalue = part.getHeader("Content-Description", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
/** * Returns the value of the "Subject" header field. Returns null * if the subject field is unavailable or its value is absent. <p> * * If the subject is encoded as per RFC 2047, it is decoded and * converted into Unicode. If the decoding or conversion fails, the * raw data is returned as is. <p> * * This implementation uses the <code>getHeader</code> method * to obtain the requisite header field. * * @return Subject * @exception MessagingException for failures * @see #headers */ public String getSubject() throws MessagingException { String rawvalue = getHeader("Subject", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
/** * Returns the value of the "Subject" header field. Returns null * if the subject field is unavailable or its value is absent. <p> * * If the subject is encoded as per RFC 2047, it is decoded and * converted into Unicode. If the decoding or conversion fails, the * raw data is returned as is. <p> * * This implementation uses the <code>getHeader</code> method * to obtain the requisite header field. * * @return Subject * @exception MessagingException for failures * @see #headers */ @Override public String getSubject() throws MessagingException { String rawvalue = getHeader("Subject", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
/** * Get the decoded subject. */ public String getSubject() throws MessagingException { checkExpunged(); if (bodyLoaded) return super.getSubject(); if (subject != null) // already cached ? return subject; loadEnvelope(); if (envelope.subject == null) // no subject return null; // Cache and return the decoded value. try { // The server *should* unfold the value, but just in case it // doesn't we unfold it here. subject = MimeUtility.decodeText(MimeUtility.unfold(envelope.subject)); } catch (UnsupportedEncodingException ex) { subject = envelope.subject; } return subject; }
/** * Get the decoded subject. */ @Override public String getSubject() throws MessagingException { checkExpunged(); if (bodyLoaded) return super.getSubject(); if (subject != null) // already cached ? return subject; loadEnvelope(); if (envelope.subject == null) // no subject return null; // Cache and return the decoded value. try { // The server *should* unfold the value, but just in case it // doesn't we unfold it here. subject = MimeUtility.decodeText(MimeUtility.unfold(envelope.subject)); } catch (UnsupportedEncodingException ex) { subject = envelope.subject; } return subject; }
refs = MimeUtility.unfold(refs) + " " + msgId; else refs = msgId;
refs = MimeUtility.unfold(refs) + " " + msgId; else refs = msgId;
protected void appendEnvelopeHeader(StringBuilder buffer, String[] value) throws UnsupportedEncodingException { if (buffer.charAt(buffer.length() - 1) != '(') { buffer.append(' '); } if (value != null && value.length > 0) { appendEnvelopeHeaderValue(buffer, MimeUtility.unfold(value[0])); } else { buffer.append("NIL"); } }
static String getDescription(MimePart part) throws MessagingException { String rawvalue = part.getHeader("Content-Description", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
static String getDescription(MimePart part) throws MessagingException { String rawvalue = part.getHeader("Content-Description", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
static String getDescription(MimePart part) throws MessagingException { String rawvalue = part.getHeader("Content-Description", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
static String getDescription(MimePart part) throws MessagingException { String rawvalue = part.getHeader("Content-Description", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
public String getDescription() throws MessagingException { String description = getSingleHeader("Content-Description"); if (description != null) { try { // this could be both folded and encoded. Return this to usable form. return MimeUtility.decodeText(MimeUtility.unfold(description)); } catch (UnsupportedEncodingException e) { // ignore } } // return the raw version for any errors. return description; }
static String getDescription(MimePart part) throws MessagingException { String rawvalue = part.getHeader("Content-Description", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
static String getDescription(MimePart part) throws MessagingException { String rawvalue = part.getHeader("Content-Description", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
static String getDescription(MimePart part) throws MessagingException { String rawvalue = part.getHeader("Content-Description", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }
static String getDescription(MimePart part) throws MessagingException { String rawvalue = part.getHeader("Content-Description", null); if (rawvalue == null) return null; try { return MimeUtility.decodeText(MimeUtility.unfold(rawvalue)); } catch (UnsupportedEncodingException ex) { return rawvalue; } }