in pekko-connectors-sample-rotate-logs-to-ftp/src/main/java/playground/filesystem/impl/JimfsFtpFile.java [296:318]
public OutputStream createOutputStream(long offset)
throws IOException {
// permission check
if (!isWritable()) {
throw new IOException("No write permission : " + path.getFileName());
}
// create output stream
final RandomAccessFile raf = new RandomAccessFile(path.toFile(), "rw");
raf.setLength(offset);
raf.seek(offset);
// The IBM jre needs to have both the stream and the random access file
// objects closed to actually close the file
return new FileOutputStream(raf.getFD()) {
@Override
public void close() throws IOException {
super.close();
raf.close();
}
};
}