File Handling in Java
All classes
required for Java I/O (Input/Ouput) will resides in java.io package .
- Byte
Streams : It handles I/O of raw binary data.
- Character
Streams : It handle I/O of character data, automatically
handling translation to and from the local character set.
- Buffered
Streams : It optimize input and output by reducing the number
of calls to the native API.
- Scanning
and Formatting : It allows a program to read and write
formatted text.
- I/O from
the Command Line : It describes the Standard Streams and
the Console object.
- Data
Streams : It handle binary I/O of primitive data type and String values.
- Object
Streams : It handle binary I/O of objects.
A stream is
considered to be a sequence of data and it is composed of bytes and there are
two kinds of streams
InputStream
: The input stream is used to read the data from a source.
OutpurSteam
: This is used to write the data to a destination.
InputStream class :
This is a
super class of all the classes which implements input stream of bytes. It is an
abstract class
Commonly used methods:
1) public abstract int read()throws
IOException : It reads the next byte of data from the input stream.It
returns -1 at the end of file.
2) public int available()throws IOException: It returns an estimate of the number
of bytes that can be read from the current input stream.
3) public void close()throws IOException:It
is used to close the current input stream.
OutputStream class :
This is a super class of all the classes which
implements ouput stream of bytes. It is an abstract class.
Commonly used methods:
1) public void write(int)throws
IOException: It is
used to write a byte to the current output stream.
2) public void write(byte[])throws
IOException:It is used to write an array of byte to the current output
stream.
3) public void flush()throws
IOException:It flushes
the current output stream.
4) public void close()throws IOException:It
is used to close the current output stream.

I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
ReplyDeleteSelenium Training in Chennai
Is there a way I can transfer all my Word Press posts into it? Any help would be appreciated.
ReplyDeletesafety course in chennai