|
|
|
@ -1633,12 +1633,20 @@ public class Helper {
|
|
|
|
|
|
|
|
|
|
static void copy(File src, File dst) throws IOException {
|
|
|
|
|
try (InputStream is = new FileInputStream(src)) {
|
|
|
|
|
try (FileOutputStream os = new FileOutputStream(dst)) {
|
|
|
|
|
try (OutputStream os = new FileOutputStream(dst)) {
|
|
|
|
|
copy(is, os);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static long copy(Context context, Uri uri, File file) throws IOException {
|
|
|
|
|
try (InputStream is = context.getContentResolver().openInputStream(uri)) {
|
|
|
|
|
try (OutputStream os = new FileOutputStream(file)) {
|
|
|
|
|
return copy(is, os);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static long copy(InputStream is, OutputStream os) throws IOException {
|
|
|
|
|
long size = 0;
|
|
|
|
|
byte[] buf = new byte[BUFFER_SIZE];
|
|
|
|
@ -1650,14 +1658,6 @@ public class Helper {
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static long copy(Context context, Uri uri, File file) throws IOException {
|
|
|
|
|
try (InputStream is = context.getContentResolver().openInputStream(uri)) {
|
|
|
|
|
try (OutputStream os = new FileOutputStream(file)) {
|
|
|
|
|
return copy(is, os);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static long getAvailableStorageSpace() {
|
|
|
|
|
StatFs stats = new StatFs(Environment.getDataDirectory().getAbsolutePath());
|
|
|
|
|
return stats.getAvailableBlocksLong() * stats.getBlockSizeLong();
|
|
|
|
|