Is it possible to use NIO with System.in?
I would like to somehow treat 'stdin' as a selectable channel. Has anyone found a way to do this?
I don't know about a SelectableChannel
, but you can convert an InputStream
to a ReadableByteChannel
with
using java.nio.channels.Channels;
...
ReadableByteChannel in = Channels.newChannel(System.in);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With