Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7cb6fa10 authored by Vincent Breitmoser's avatar Vincent Breitmoser
Browse files

stream performance optimizations

parent 032b1fb8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
package com.fsck.k9.mailstore;


import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -63,7 +64,7 @@ public class ProvidedTempFileBody extends BinaryAttachmentBody implements SizeAw
        try {
            if (file != null) {
                Log.d(K9.LOG_TAG, "Decrypted data is file-backed.");
                return new FileInputStream(file);
                return new BufferedInputStream(new FileInputStream(file));
            }
            if (data != null) {
                Log.d(K9.LOG_TAG, "Decrypted data is memory-backed.");
+2 −2
Original line number Diff line number Diff line
@@ -34,12 +34,12 @@ import com.fsck.k9.mail.internet.SizeAware;
import com.fsck.k9.mail.internet.TextBody;
import com.fsck.k9.mailstore.CryptoResultAnnotation;
import com.fsck.k9.mailstore.CryptoResultAnnotation.CryptoError;
import com.fsck.k9.mailstore.MimePartStreamParser;
import com.fsck.k9.mailstore.LocalMessage;
import com.fsck.k9.mailstore.MessageHelper;
import org.apache.commons.io.IOUtils;
import com.fsck.k9.mailstore.MimePartStreamParser;
import com.fsck.k9.provider.DecryptedFileProvider;
import com.fsck.k9.service.FileProviderInterface;
import org.apache.commons.io.IOUtils;
import org.openintents.openpgp.IOpenPgpService2;
import org.openintents.openpgp.OpenPgpDecryptionResult;
import org.openintents.openpgp.OpenPgpError;
+3 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
package org.openintents.openpgp.util;


import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -93,8 +94,9 @@ public class ParcelFileDescriptorUtil {

    public static <T> DataSinkTransferThread<T> asyncPipeToDataSink(
            OpenPgpDataSink<T> dataSink, ParcelFileDescriptor output) throws IOException {
        InputStream inputStream = new BufferedInputStream(new AutoCloseInputStream(output));
        DataSinkTransferThread<T> dataSinkTransferThread =
                new DataSinkTransferThread<T>(dataSink, new AutoCloseInputStream(output));
                new DataSinkTransferThread<T>(dataSink, inputStream);
        dataSinkTransferThread.start();
        return dataSinkTransferThread;
    }