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

Commit e5cd0903 authored by Jing Ji's avatar Jing Ji Committed by Android (Google) Code Review
Browse files

Merge "Finish the GZIPOutputStream after copying the data into it"

parents e857186c 2c083c8b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.SortedSet;
@@ -446,7 +445,10 @@ public final class DropBoxManagerService extends SystemService {
            // from an in-memory buffer, or another file on disk; if we buffered
            // we'd lose out on sendfile() optimizations
            if (forceCompress) {
                FileUtils.copy(in, new GZIPOutputStream(new FileOutputStream(fd)));
                final GZIPOutputStream gzipOutputStream =
                        new GZIPOutputStream(new FileOutputStream(fd));
                FileUtils.copy(in, gzipOutputStream);
                gzipOutputStream.finish();
            } else {
                FileUtils.copy(in, new FileOutputStream(fd));
            }