try {
FileInputStream fileInputStream = new FileInputStream(file);
fileInputStream.getChannel().lock(0L, Long.MAX_VALUE, true);
return fileInputStream;
} catch (FileNotFoundException e) {
throw new FileSystemInteractionException(String.format("Could not find file %s", file), e);
} catch (IOException e) {
throw new FileSystemInteractionException(String.format("Could not read file %s", file), e);
}
}