Search in sources :

Example 1 with CountingOutputStream

use of com.fsck.k9.mail.filter.CountingOutputStream in project k-9 by k9mail.

the class Message method calculateSize.

public long calculateSize() {
    try (CountingOutputStream out = new CountingOutputStream()) {
        EOLConvertingOutputStream eolOut = new EOLConvertingOutputStream(out);
        writeTo(eolOut);
        eolOut.flush();
        return out.getCount();
    } catch (IOException | MessagingException e) {
        Timber.e(e, "Failed to calculate a message size");
    }
    return 0;
}
Also used : EOLConvertingOutputStream(com.fsck.k9.mail.filter.EOLConvertingOutputStream) CountingOutputStream(com.fsck.k9.mail.filter.CountingOutputStream) IOException(java.io.IOException)

Example 2 with CountingOutputStream

use of com.fsck.k9.mail.filter.CountingOutputStream in project k-9 by k9mail.

the class TextBody method getLengthWhenQuotedPrintableEncoded.

private long getLengthWhenQuotedPrintableEncoded(byte[] bytes) throws IOException {
    CountingOutputStream countingOutputStream = new CountingOutputStream();
    writeSignSafeQuotedPrintable(countingOutputStream, bytes);
    return countingOutputStream.getCount();
}
Also used : CountingOutputStream(com.fsck.k9.mail.filter.CountingOutputStream)

Aggregations

CountingOutputStream (com.fsck.k9.mail.filter.CountingOutputStream)2 EOLConvertingOutputStream (com.fsck.k9.mail.filter.EOLConvertingOutputStream)1 IOException (java.io.IOException)1