The following code catch IOException:
public static Flux
Assert.notNull(path, "Path must not be null");
Assert.notNull(bufferFactory, "DataBufferFactory must not be null");
Assert.isTrue(bufferSize > 0, "'bufferSize' must be > 0");
if (options.length > 0) {
for (OpenOption option : options) {
Assert.isTrue(!(option == StandardOpenOption.APPEND || option == StandardOpenOption.WRITE),
() -> "'" + option + "' not allowed");
}
}
return readAsynchronousFileChannel(() -> AsynchronousFileChannel.open(path, options),
bufferFactory, bufferSize);
}
It is strange that the two methods handle exceptions differently.
Comment From: snicoll
One needs to skip to a given position, the other doesn't (hence the fallback). There's no fallback for the other one so I don't find this strange.
Going forward, we prefer a description of an actual problem you'd be facing (in the form of a small sample we can run ourselves) rather than copy/pasting our code.