MCPcopy Index your code
hub / github.com/questdb/questdb / copyInputStream

Method copyInputStream

core/src/main/java/io/questdb/Bootstrap.java:397–421  ·  view source on GitHub ↗
(boolean force, byte[] buffer, File out, InputStream is, Log log)

Source from the content-addressed store, hash-verified

395 }
396
397 private static void copyInputStream(boolean force, byte[] buffer, File out, InputStream is, Log log) throws IOException {
398 final boolean exists = out.exists();
399 if (force || !exists) {
400 File dir = out.getParentFile();
401 if (!dir.exists() && !dir.mkdirs()) {
402 if (log != null) {
403 log.errorW().$("could not create directory [path=").$(dir).I$();
404 }
405 return;
406 }
407 try (FileOutputStream fos = new FileOutputStream(out)) {
408 int n;
409 while ((n = is.read(buffer, 0, buffer.length)) > 0) {
410 fos.write(buffer, 0, n);
411 }
412 }
413 if (log != null) {
414 log.infoW().$("extracted [path=").$(out).I$();
415 }
416 return;
417 }
418 if (log != null) {
419 log.debugW().$("skipped [path=").$(out).I$();
420 }
421 }
422
423 private static void copyResource(String dir, boolean force, byte[] buffer, String res, String dest, Log log) throws IOException {
424 File out = new File(dir, dest);

Callers 2

copyResourceMethod · 0.95
extractSite0Method · 0.95

Calls 9

I$Method · 0.80
existsMethod · 0.65
mkdirsMethod · 0.65
$Method · 0.65
errorWMethod · 0.65
readMethod · 0.65
writeMethod · 0.65
infoWMethod · 0.65
debugWMethod · 0.65

Tested by

no test coverage detected