mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-15 14:24:59 +00:00
Utility: Buffer the output to files when serializing
This commit is contained in:
parent
882fbf9275
commit
ae8121b680
@ -12,6 +12,7 @@ import android.widget.Toast;
|
|||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@ -59,17 +60,17 @@ public class Utility {
|
|||||||
ObjectOutputStream objectOutputStream = null;
|
ObjectOutputStream objectOutputStream = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
objectOutputStream = new ObjectOutputStream(new FileOutputStream(fileName));
|
objectOutputStream = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(fileName)));
|
||||||
objectOutputStream.writeObject(serializable);
|
objectOutputStream.writeObject(serializable);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//nothing to do
|
//nothing to do
|
||||||
}
|
} finally {
|
||||||
|
if(objectOutputStream != null) {
|
||||||
if(objectOutputStream != null) {
|
try {
|
||||||
try {
|
objectOutputStream.close();
|
||||||
objectOutputStream.close();
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
//nothing to do
|
||||||
//nothing to do
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user