Methods Summary |
---|
public int | available()
if (caughtException != null || wrapped == null) {
throwException();
}
return wrapped.available();
|
public void | close()
if (caughtException != null || wrapped == null) {
throwException();
}
wrapped.close();
wrapped = null;
|
private void | closeOutputStreams(java.io.OutputStream headerStream, java.io.OutputStream bodyStream)Closes output streams used to update message
try {
// If the header stream is not the same as the body stream,
// close the header stream here.
if ((headerStream != null) && (headerStream != bodyStream)) {
headerStream.close();
}
} finally {
if (bodyStream != null) {
bodyStream.close();
}
}
|
public long | getSize()Returns the size of the full message
return size;
|
public synchronized void | mark(int arg0)
wrapped.mark(arg0);
|
public boolean | markSupported()
return wrapped.markSupported();
|
public int | read(byte[] arg0, int arg1, int arg2)
if (caughtException != null || wrapped == null) {
throwException();
}
return wrapped.read(arg0, arg1, arg2);
|
public int | read(byte[] arg0)
if (caughtException != null || wrapped == null) {
throwException();
}
return wrapped.read(arg0);
|
public int | read()
if (caughtException != null || wrapped == null) {
throwException();
}
return wrapped.read();
|
public synchronized void | reset()
if (caughtException != null || wrapped == null) {
throwException();
}
wrapped.reset();
|
public long | skip(long arg0)
if (caughtException != null || wrapped == null) {
throwException();
}
return wrapped.skip(arg0);
|
private void | throwException()
try {
if (wrapped == null) {
throw new IOException("wrapped stream does not exists anymore");
} else if (caughtException instanceof IOException) {
throw (IOException) caughtException;
} else {
throw new IOException("Exception caugth in worker thread "+caughtException.getMessage()) {
/**
* @see java.lang.Throwable#getCause()
*/
public Throwable getCause() {
return caughtException;
}
};
}
} finally {
caughtException = null;
wrapped = null;
}
|
private void | writeStream(org.apache.mailet.Mail mail, java.io.OutputStream out)write the full mail to the stream
This can be used by this object or by the worker threads.
OutputStream bodyOut = null;
try {
if (streamRep == null) {
//If there is no filestore, use the byte array to store headers
// and the body
bodyOut = out;
} else {
//Store the body in the stream repository
bodyOut = streamRep.put(mail.getName());
}
//Write the message to the headerOut and bodyOut. bodyOut goes straight to the file
MimeMessageUtil.writeTo(mail.getMessage(), out, bodyOut);
out.flush();
bodyOut.flush();
} finally {
closeOutputStreams(out, bodyOut);
}
|