Publisher : RAKESH P
Course Language : English
It is used to process the input and produce the output.
It uses stream to make operations faster.
java io package contains all the classes for IO.
Sequence of data
Stream is made of byte
output stream used for writing data to a file
Java FileInputStream :
It is used to read data in the form of bytes from file. It is used for reading byte-oriented data like audio, video, image and etc.
It internally uses buffer to store data.
It is more efficient way to write data than FileOutputStream public class BufferedOutputStream extends FilterOutputStream
BufferedInputStream class is used to read information from stream It internally uses buffer mechanism to make the performance fast
Java SequenceInputStream class is used to read data from multiple streams.
It reads data sequentially
It is used to write common data into multiple files.
It holds a copy and forwards it to multiple streams.
It writes primitive Java data types to the output stream in a machine-independent way.
It reads primitive data from the input stream in a machine-independent way.
What is character encoding?
Since every data in computer is represented in bytes and Strings are essentially collection of characters.
To convert bytes into character JVM needs to know which combination of bytes represent which character and this is what character encoding tells JVM.
There are many languages in the World like English, Tamil, Telugu and etc.
This is the reason why we need to give correct character encoding while converting the bytes to String.
It is used to write character-oriented data to a file.
Unlike FileOutputStream class, you don't need to convert string into byte array because it provides method to write string directly.
It is used to provide buffering for Writer instance.
It makes the performance fast.