Don't do single byte writes in DropBoxManagerService
Bug: 3018772 Change-Id: I6990041f059aeb2a4c29e59b1a3d78d19bf9b02f
This commit is contained in:
@@ -36,6 +36,7 @@ import android.util.Slog;
|
||||
|
||||
import com.android.internal.os.IDropBoxManagerService;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -179,7 +180,10 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
|
||||
// the data in uncompressed form.
|
||||
|
||||
temp = new File(mDropBoxDir, "drop" + Thread.currentThread().getId() + ".tmp");
|
||||
output = new FileOutputStream(temp);
|
||||
int bufferSize = mBlockSize;
|
||||
if (bufferSize > 4096) bufferSize = 4096;
|
||||
if (bufferSize < 512) bufferSize = 512;
|
||||
output = new BufferedOutputStream(new FileOutputStream(temp), bufferSize);
|
||||
if (read == buffer.length && ((flags & DropBoxManager.IS_GZIPPED) == 0)) {
|
||||
output = new GZIPOutputStream(output);
|
||||
flags = flags | DropBoxManager.IS_GZIPPED;
|
||||
|
||||
Reference in New Issue
Block a user