In this section we will discussed about How files can be handled in Java.
In this tutorial we will learn the various aspect of file handling in Java.
Most of the software's important feature is how to read data of a file and/or write them to a file. In Java java.io package is available that lets the Java Developer to handle files. java.io package contains the classes which are required in to perform input and output operations in Java.
When we are talking about the input and output operations we will be required to deal with the streams. So, first we will discussed about the Stream.
What is Stream ?
We can say that a stream is a different kinds of sources and destinations such as the disk files, devices, memory arrays. Stream is a sequence of data (simple bytes, primitive data types, localized characters, objects) which flows the information that may be an input source or an output destination for example a console, file, buffer, etc. In Java you will see the various I/O Streams
As we will progress in our discussion, we will be required to deal with the Stream classes and the Reader/Writer classes. So, here we will first discussed the difference between these classes.
|Stream Classes||Reader/Writer Classes|
|Stream classes are byte oriented||Reader/Writer classes are character oriented|
|Doesn't support Unicode characters||Supports Unicode characters|
|Perform input/output of 8-bit bytes||Perform input/output of 16-bit Unicode characters|
|Since JDK 1.0||Since JDK 1.1|
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial