in src/main/java/org/apache/sling/commons/jcr/file/internal/JcrFileChannel.java [73:88]
private FileChannel init() throws IOException {
Binary binary = null;
try {
binary = getBinary();
} catch (Exception e) {
logger.error("reading binary failed: {}", e.getMessage(), e);
}
if (binary != null) {
try (final InputStream inputStream = binary.getStream()) {
Files.copy(inputStream, file, REPLACE_EXISTING);
} catch (Exception e) {
logger.error("copying binary to file failed: {}", e.getMessage(), e);
}
}
return FileChannel.open(file, READ, WRITE);
}