by Dinesh Thakur Category: Stream

There are numerous classes available for reading/writing bytes from/to file, memory or even a network socket. We have already given a brief overview of byte stream classes and we shall now discuss them in detail.

 
by Dinesh Thakur Category: Stream

The constructor of FileOutputStream class is overload, when we pass Boolean argument (true) in the constructor of FileOutputStream, then the new text append in the file.

 
by Dinesh Thakur Category: Stream

FileInputStream is a is present in java.io package and is the child class of InputStream class. It reads data in the form of bytes from a text file.



 
by Dinesh Thakur Category: Stream

FileOutputStream is a class present in java.io package and child class of outputstream class. It Stores data in the form of bytes. It is used to create a text file.



 
by Dinesh Thakur Category: Stream

The java.io package contains stream classes that support for reading and writing. To use these stream classes, we import the java.io package. For reading characters, we prefer Reader class and we use subclass BufferedReader to read data.



 
by Dinesh Thakur Category: Stream

RandomAccessFile provides you to read or write data from or to in a file at any location. It supports you to move around the file, and read from it and write to it, where ever you like.

 
by Dinesh Thakur Category: Stream

Java makes available a set of classes and methods that allows you to read from and write to files. Java supports both streams and methods to read from and write to file respectively.

 
by Dinesh Thakur Category: Stream

System.out.println() and System.out.print() are only used method for output on console. But there is a class PrintStream a drived class of OutputStream having a implemented method write(), it can be used to write to the console. The simplest form of write() is :

 
by Dinesh Thakur Category: Stream

To read a string form the Buffered Reader object, use the following version of readLine() method.

                           String readLine( ) throws IOException

 
by Dinesh Thakur Category: Stream

To read a character form the Buffered Reader object, use the following version of read() method. int read( ) throws IOException

The method read() will return a integer value corresponding the character from the input stream and if end of the stream come across then it will return -1.

 

Page 3 of 3



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles