In H. Shildt's book I read:
Channels do not exist without context. The context for these is a series of I/O stream classes from java.io.
I've also seen this statement when learning NIO, but very few times.
Anyway, the following code works without creating I/O stream. Why? And what variant is right - with or without IO streams?
try (FileChannel channel = (FileChannel)
Files.newByteChannel(Paths.get("test.txt")) ) {
// some code
} catch(...)