MCPcopy Create free account
hub / github.com/M66B/FairEmail / writeTo

Method writeTo

app/src/main/java/com/sun/mail/pop3/POP3Message.java:559–588  ·  view source on GitHub ↗

Output the message as an RFC 822 format stream, without specified headers. If the property "mail.pop3.cachewriteto" is set to "true", and ignoreList is null, and the message hasn't already been cached as a side effect of other operations, the message content is cached before being written. Otherwi

(OutputStream os, String[] ignoreList)

Source from the content-addressed store, hash-verified

557 * @see javax.activation.DataHandler#writeTo
558 */
559 @Override
560 public synchronized void writeTo(OutputStream os, String[] ignoreList)
561 throws IOException, MessagingException {
562 InputStream rawcontent = rawData.get();
563 if (rawcontent == null && ignoreList == null &&
564 !((POP3Store)(folder.getStore())).cacheWriteTo) {
565 if (folder.logger.isLoggable(Level.FINE))
566 folder.logger.fine("streaming msg " + msgnum);
567 if (!folder.getProtocol().retr(msgnum, os)) {
568 expunged = true;
569 throw new MessageRemovedException("can't retrieve message #" +
570 msgnum + " in POP3Message.writeTo"); // XXX - what else?
571 }
572 } else if (rawcontent != null && ignoreList == null) {
573 // can just copy the cached data
574 InputStream in = ((SharedInputStream)rawcontent).newStream(0, -1);
575 try {
576 byte[] buf = new byte[16*1024];
577 int len;
578 while ((len = in.read(buf)) > 0)
579 os.write(buf, 0, len);
580 } finally {
581 try {
582 if (in != null)
583 in.close();
584 } catch (IOException ex) { }
585 }
586 } else
587 super.writeTo(os, ignoreList);
588 }
589
590 /**
591 * Load the headers for this message into the InternetHeaders object.

Callers

nothing calls this directly

Calls 11

fineMethod · 0.80
retrMethod · 0.80
newStreamMethod · 0.65
writeToMethod · 0.65
getMethod · 0.45
getStoreMethod · 0.45
isLoggableMethod · 0.45
getProtocolMethod · 0.45
readMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected