Use cases OutputStream(java.io) vs Channel(java.nio)

212 Views Asked by At

Did i right understand, what Channel used for cases, when data, which we want to write - is not full received/prepared data?

But OutputStream used for case when we can write all data already now.

Another words:
nio - when we asynchronous getting data for writing
io - when we synchronous got data for writing

1

There are 1 best solutions below

0
On
  1. There is no such a type as java.io.Stream;

  2. If you, by any means, meant java.util.Stream and java.nio.channels.Channels, then they are two completely different types serving different purposes;

  3. Finally, if you are comparing java.io and java.nio, then io is about reading and writing, whereas nio is about faster I/O, a.k.a buffered-reading and buffered-writing operations.