33
33
import com .google .firebase .annotations .concurrent .Background ;
34
34
import com .google .firebase .appdistribution .FirebaseAppDistributionException ;
35
35
import com .google .firebase .appdistribution .FirebaseAppDistributionException .Status ;
36
+ import java .io .BufferedOutputStream ;
36
37
import java .io .FileNotFoundException ;
37
- import java .io .FileOutputStream ;
38
38
import java .io .IOException ;
39
39
import java .util .concurrent .Executor ;
40
40
@@ -141,7 +141,7 @@ private Uri writeToFile(@Nullable Bitmap bitmap) throws FirebaseAppDistributionE
141
141
// First delete the previous file if it's still there
142
142
deleteScreenshot ();
143
143
144
- try (FileOutputStream outputStream = openFileOutputStream ()) {
144
+ try (BufferedOutputStream outputStream = openFileOutputStream ()) {
145
145
// PNG is a lossless format, the compression factor (100) is ignored
146
146
bitmap .compress (Bitmap .CompressFormat .PNG , /* quality= */ 100 , outputStream );
147
147
} catch (IOException e ) {
@@ -157,9 +157,10 @@ void deleteScreenshot() {
157
157
firebaseApp .getApplicationContext ().deleteFile (SCREENSHOT_FILE_NAME );
158
158
}
159
159
160
- private FileOutputStream openFileOutputStream () throws FileNotFoundException {
161
- return firebaseApp
162
- .getApplicationContext ()
163
- .openFileOutput (SCREENSHOT_FILE_NAME , Context .MODE_PRIVATE );
160
+ private BufferedOutputStream openFileOutputStream () throws FileNotFoundException {
161
+ return new BufferedOutputStream (
162
+ firebaseApp
163
+ .getApplicationContext ()
164
+ .openFileOutput (SCREENSHOT_FILE_NAME , Context .MODE_PRIVATE ));
164
165
}
165
166
}
0 commit comments