INNER CODE UNIT · Java
copy
KeepSafe/ReLinker · relinker/src/main/java/com/getkeepsafe/relinker/ApkLibraryInstaller.java:237
private long copy(InputStream in, OutputStream out) throws IOException {
long copied = 0;
byte[] buf = new byte[COPY_BUFFER_SIZE];
while (true) {
int read = in.read(buf);
if (read == -1) {
break;
}
out.write(buf, 0, read);
copied += read;
}
out.flush();
return copied;
}
/**
* Closes a {@link Closeable} silently (without throwing or handling any exceptions)
* @param closeable {@link Closeable} to close