1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-02-21 13:47:04 +00:00

Refactoring

This commit is contained in:
M66B 2019-11-30 12:50:39 +01:00
parent 6810391776
commit 221b9c3874

View file

@ -87,6 +87,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
@ -692,14 +693,18 @@ public class Helper {
static void copy(File src, File dst) throws IOException {
try (InputStream in = new FileInputStream(src)) {
try (FileOutputStream out = new FileOutputStream(dst)) {
byte[] buf = new byte[BUFFER_SIZE];
int len;
while ((len = in.read(buf)) > 0)
out.write(buf, 0, len);
copy(in, out);
}
}
}
static void copy(InputStream in, OutputStream out) throws IOException {
byte[] buf = new byte[BUFFER_SIZE];
int len;
while ((len = in.read(buf)) > 0)
out.write(buf, 0, len);
}
static long getStorageSpace() {
StatFs stats = new StatFs(Environment.getDataDirectory().getAbsolutePath());
return stats.getAvailableBlocksLong() * stats.getBlockSizeLong();