mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 13:47:04 +00:00
Refactoring
This commit is contained in:
parent
6810391776
commit
221b9c3874
1 changed files with 9 additions and 4 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue