mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
26 lines
478 B
Java
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;
|
|
}
|
|
|
|
}
|