Home > front end >  Types of Streams based on Data Flow?
Types of Streams based on Data Flow?

Time:12-16

Long Story Short: How many types of Streams are there based on Data Flow in the java.io package? Are they Byte Streams and Character Streams or Binary Streams and Character Streams?

Full Question:

https://youtu.be/v1_ATyL4CNQ?t=20m5s Skip to 20:05 After watching this tutorial yesterday, I was left with the impression that there are 2 Types of Streams, based on Data Flow: BinaryStreams and CharacterStreams. Today after learning more about the topic, my new findings seem to contradict the old ones.

Most of the people on the internet divide the Streams into 2 types Byte Streams and Character Streams. However when searching oracle docs I found information about Binary Streams too, then I found information about Int, Double, Long Streams from the java.util.stream package.

I am sorry if I am asking a silly question, but I am really confused right now.

CodePudding user response:

The naming is really confusing

The I/O streams (Byte Streams and Character Streams) are data streams are completely unrelated to the new Stream API (java.util.stream). So we are talking here about two differents things with the same name "stream".

IO Streams : used on Input/output operations reading the data from a resource (input), or writing the data to a resource (output).

java.util.stream :include Stream,IntStream,DoubleStream... Stream definition by Oracle documentation is a sequence of elements supporting sequential and parallel aggregate operations.

  • Related