mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-09-19 02:54:03 +00:00
Utility: Buffer the output to files when serializing
This commit is contained in:
@@ -12,6 +12,7 @@ import android.widget.Toast;
|
||||
import org.schabi.newpipe.R;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -59,12 +60,11 @@ public class Utility {
|
||||
ObjectOutputStream objectOutputStream = null;
|
||||
|
||||
try {
|
||||
objectOutputStream = new ObjectOutputStream(new FileOutputStream(fileName));
|
||||
objectOutputStream = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(fileName)));
|
||||
objectOutputStream.writeObject(serializable);
|
||||
} catch (Exception e) {
|
||||
//nothing to do
|
||||
}
|
||||
|
||||
} finally {
|
||||
if(objectOutputStream != null) {
|
||||
try {
|
||||
objectOutputStream.close();
|
||||
@@ -73,6 +73,7 @@ public class Utility {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings("unchecked")
|
||||
|
Reference in New Issue
Block a user