Files
arcanechat-android/src/main/java/org/thoughtcrime/securesms/util/StreamUtil.java
T
2024-06-13 17:18:48 +02:00

26 lines
478 B
Java

package org.thoughtcrime.securesms.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class StreamUtil {
public static long copy(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[64 * 1024];
int read;
long total = 0;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
total += read;
}
in.close();
out.close();
return total;
}
}