//  XXX - what else?
protected InputStream getContentStream()
					throws MessagingException {
	try {
	synchronized(this) {
	    if (contentStream == null) {
		InputStream rawcontent = folder.getProtocol().retr(msgnum,
					msgSize > 0 ? msgSize + hdrSize : 0);
		if (rawcontent == null) {
		    expunged = true;
		    throw new MessageRemovedException();    //  XXX - what else?
		}
		if (headers == null ||
			((POP3Store)(folder.getStore())).forgetTopHeaders) {
		    headers = new InternetHeaders(rawcontent);
		    hdrSize =
			(int)((SharedInputStream)rawcontent).getPosition();
		} else {
		    /*
		     * Already have the headers, have to skip the headers
		     * in the content array and return the body.
		     *
		     * XXX - It seems that some mail servers return slightly
		     * different headers in the RETR results than were returned
		     * in the TOP results, so we can't depend on remembering
		     * the size of the headers from the TOP command and just
		     * skipping that many bytes.  Instead, we have to process
		     * the content, skipping over the header until we come to
		     * the empty line that separates the header from the body.
		     */
		    int offset = 0;
		    for (;;) {
			int len = 0;	// number of bytes in this line
			int c1;
			while ((c1 = rawcontent.read()) >= 0) {
			    if (c1 == '\n')	// end of line
				break;
			    else if (c1 == '\r') {
				// got CR, is the next char LF?
				if (rawcontent.available() > 0) {
				    rawcontent.mark(1);
				    if (rawcontent.read() != '\n')
					rawcontent.reset();
				}
				break;	// in any case, end of line
			    }
			    // not CR, NL, or CRLF, count the byte
			    len++;
			}
			// here when end of line or out of data
			// if out of data, we're done
			if (rawcontent.available() == 0)
			    break;
			// if it was an empty line, we're done
			if (len == 0)
			    break;
		    }
		    hdrSize =
			(int)((SharedInputStream)rawcontent).getPosition();
		}
		contentStream =
		    ((SharedInputStream)rawcontent).newStream(hdrSize, -1);
		rawcontent = null;	// help GC
	    }
	}
	} catch (EOFException eex) {
	    folder.close(false);
	    throw new FolderClosedException(folder, eex.toString());
	} catch (IOException ex) {
	    throw new MessagingException("error fetching POP3 content", ex);
	}
	return super.getContentStream();
    }
if (rawcontent == null) {
expunged = true;
throw new MessageRemovedException(); // XXX - what else?
}
if (headers == null ||
protected InputStream getContentStream()
throws MessagingException {
try {
synchronized(this) {
if (contentStream == null) {
InputStream rawcontent = folder.getProtocol().retr(msgnum,
msgSize > 0 ? msgSize + hdrSize : 0);
if (rawcontent == null) {
expunged = true;
throw new MessageRemovedException(); // XXX - what else?
}
if (headers == null ||
((POP3Store)(folder.getStore())).forgetTopHeaders) {
headers = new InternetHeaders(rawcontent);
hdrSize =
(int)((SharedInputStream)rawcontent).getPosition();
} else {
/*
* Already have the headers, have to skip the headers
* in the content array and return the body.
protected InputStream getContentStream()
throws MessagingException {
try {
synchronized(this) {
if (contentStream == null) {
InputStream rawcontent = folder.getProtocol().retr(msgnum,
msgSize > 0 ? msgSize + hdrSize : 0);
if (rawcontent == null) {
expunged = true;
throw new MessageRemovedException(); // XXX - what else?
}
if (headers == null ||
((POP3Store)(folder.getStore())).forgetTopHeaders) {
headers = new InternetHeaders(rawcontent);
hdrSize =
(int)((SharedInputStream)rawcontent).getPosition();
} else {
/*
* Already have the headers, have to skip the headers
* in the content array and return the body.
*
* XXX - It seems that some mail servers return slightly
* different headers in the RETR results than were returned
* in the TOP results, so we can't depend on remembering
* the size of the headers from the TOP command and just
* skipping that many bytes. Instead, we have to process
* the content, skipping over the header until we come to
* the empty line that separates the header from the body.
*/
int offset = 0;