Methods Summary |
---|
public void | addHeader(java.lang.String arg0, java.lang.String arg1)If the new header is a Return-Path we get sure that we add it to the top
Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream with
a return-path in the middle.
if (RFC2822Headers.RETURN_PATH.equalsIgnoreCase(arg0)) {
headers.add(0, new InternetHeader(arg0, arg1));
} else {
super.addHeader(arg0, arg1);
}
|
protected java.lang.Object | clone()
// TODO Auto-generated method stub
return super.clone();
|
public boolean | isSet(java.lang.String name)Check if a particular header is present.
String[] value = super.getHeader(name);
return (value != null && value.length != 0);
|
public boolean | isValid()Check if all REQUIRED headers fields as specified in RFC 822
are present.
return (isSet(RFC2822Headers.DATE) && isSet(RFC2822Headers.TO) && isSet(RFC2822Headers.FROM));
|
public void | setHeader(java.lang.String arg0, java.lang.String arg1)If the new header is a Return-Path we get sure that we add it to the top
Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream with
a return-path in the middle.
if (RFC2822Headers.RETURN_PATH.equalsIgnoreCase(arg0)) {
super.removeHeader(arg0);
}
super.setHeader(arg0, arg1);
|
public byte[] | toByteArray()Generate a representation of the headers as a series of bytes.
ByteArrayOutputStream headersBytes = new ByteArrayOutputStream();
writeTo(headersBytes);
return headersBytes.toByteArray();
|
public void | writeTo(java.io.OutputStream out)Write the headers to an output stream
PrintStream pout;
if (out instanceof PrintStream) {
pout = (PrintStream)out;
} else {
pout = new PrintStream(out);
}
for (Enumeration e = super.getAllHeaderLines(); e.hasMoreElements(); ) {
pout.print((String) e.nextElement());
pout.print("\r\n");
}
// Print trailing CRLF
pout.print("\r\n");
|