in src/main/java/org/apache/sling/launchpad/base/shared/Loader.java [277:300]
public static void spool(InputStream ins, File destFile) throws IOException {
OutputStream out = null;
try {
out = new FileOutputStream(destFile);
byte[] buf = new byte[8192];
int rd;
while ((rd = ins.read(buf)) >= 0) {
out.write(buf, 0, rd);
}
} finally {
if (ins != null) {
try {
ins.close();
} catch (IOException ignore) {
}
}
if (out != null) {
try {
out.close();
} catch (IOException ignore) {
}
}
}
}