Methods Summary |
---|
public void | addHeader(java.lang.String name, java.lang.String value)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
public void | addHeaderLine(java.lang.String line)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
public java.util.Enumeration | getAllHeaderLines()
loadHeaders();
return super.getAllHeaderLines();
|
public java.util.Enumeration | getAllHeaders()
loadHeaders();
return super.getAllHeaders();
|
public java.lang.String | getContentID()
return bs.id;
|
public java.lang.String | getContentMD5()
return bs.md5;
|
protected java.io.InputStream | getContentStream()
InputStream is = null;
boolean pk = message.getPeek(); // acquire outisde of message cache lock
// Acquire MessageCacheLock, to freeze seqnum.
synchronized(message.getMessageCacheLock()) {
try {
IMAPProtocol p = message.getProtocol();
// Check whether this message is expunged
message.checkExpunged();
if (p.isREV1() && (message.getFetchBlockSize() != -1))
return new IMAPInputStream(message, sectionId, bs.size, pk);
// Else, vanila IMAP4, no partial fetch
int seqnum = message.getSequenceNumber();
BODY b;
if (pk)
b = p.peekBody(seqnum, sectionId);
else
b = p.fetchBody(seqnum, sectionId);
if (b != null)
is = b.getByteArrayInputStream();
} catch (ConnectionException cex) {
throw new FolderClosedException(
message.getFolder(), cex.getMessage());
} catch (ProtocolException pex) {
throw new MessagingException(pex.getMessage(), pex);
}
}
if (is == null)
throw new MessagingException("No content");
else
return is;
|
public java.lang.String | getContentType()
return type;
|
public synchronized javax.activation.DataHandler | getDataHandler()
if (dh == null) {
if (bs.isMulti())
dh = new DataHandler(
new IMAPMultipartDataSource(
this, bs.bodies, sectionId, message)
);
else if (bs.isNested() && message.isREV1())
dh = new DataHandler(
new IMAPNestedMessage(message,
bs.bodies[0],
bs.envelope,
sectionId),
type
);
}
return super.getDataHandler();
|
public java.lang.String | getDescription()
if (description != null) // cached value ?
return description;
if (bs.description == null)
return null;
try {
description = MimeUtility.decodeText(bs.description);
} catch (UnsupportedEncodingException ex) {
description = bs.description;
}
return description;
|
public java.lang.String | getDisposition()
return bs.disposition;
|
public java.lang.String | getEncoding()
return bs.encoding;
|
public java.lang.String | getFileName()
String filename = null;
if (bs.dParams != null)
filename = bs.dParams.get("filename");
if (filename == null && bs.cParams != null)
filename = bs.cParams.get("name");
return filename;
|
public java.lang.String[] | getHeader(java.lang.String name)
loadHeaders();
return super.getHeader(name);
|
public int | getLineCount()
return bs.lines;
|
public java.util.Enumeration | getMatchingHeaderLines(java.lang.String[] names)
loadHeaders();
return super.getMatchingHeaderLines(names);
|
public java.util.Enumeration | getMatchingHeaders(java.lang.String[] names)
loadHeaders();
return super.getMatchingHeaders(names);
|
public java.util.Enumeration | getNonMatchingHeaderLines(java.lang.String[] names)
loadHeaders();
return super.getNonMatchingHeaderLines(names);
|
public java.util.Enumeration | getNonMatchingHeaders(java.lang.String[] names)
loadHeaders();
return super.getNonMatchingHeaders(names);
|
public int | getSize()
return bs.size;
|
private synchronized void | loadHeaders()
if (headersLoaded)
return;
if (headers == null)
headers = new InternetHeaders();
// load headers
// Acquire MessageCacheLock, to freeze seqnum.
synchronized(message.getMessageCacheLock()) {
try {
IMAPProtocol p = message.getProtocol();
// Check whether this message got expunged
message.checkExpunged();
if (p.isREV1()) {
int seqnum = message.getSequenceNumber();
BODY b = p.peekBody(seqnum, sectionId + ".MIME");
if (b == null)
throw new MessagingException("Failed to fetch headers");
ByteArrayInputStream bis = b.getByteArrayInputStream();
if (bis == null)
throw new MessagingException("Failed to fetch headers");
headers.load(bis);
} else {
// RFC 1730 does not provide for fetching BodyPart headers
// So, just dump the RFC1730 BODYSTRUCTURE into the
// headerStore
// Content-Type
headers.addHeader("Content-Type", type);
// Content-Transfer-Encoding
headers.addHeader("Content-Transfer-Encoding", bs.encoding);
// Content-Description
if (bs.description != null)
headers.addHeader("Content-Description",
bs.description);
// Content-ID
if (bs.id != null)
headers.addHeader("Content-ID", bs.id);
// Content-MD5
if (bs.md5 != null)
headers.addHeader("Content-MD5", bs.md5);
}
} catch (ConnectionException cex) {
throw new FolderClosedException(
message.getFolder(), cex.getMessage());
} catch (ProtocolException pex) {
throw new MessagingException(pex.getMessage(), pex);
}
}
headersLoaded = true;
|
public void | removeHeader(java.lang.String name)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
public void | setContent(java.lang.Object o, java.lang.String type)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
public void | setContent(javax.mail.Multipart mp)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
public void | setContentMD5(java.lang.String md5)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
public void | setDataHandler(javax.activation.DataHandler content)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
public void | setDescription(java.lang.String description, java.lang.String charset)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
public void | setDisposition(java.lang.String disposition)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
public void | setFileName(java.lang.String filename)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
public void | setHeader(java.lang.String name, java.lang.String value)
throw new IllegalWriteException("IMAPBodyPart is read-only");
|
protected void | updateHeaders()
return;
|