BufferedWriter in Java

A Buffer is a temporary storage area for data. The reader and writer classes provides character input and outout streams .The writer class is an output stream .It is an abstract class that cannot be directly instantiated.Creates a buffered character-output stream we use BufferedWriter class.

Byte Streams in Java

The FileReader and FileWriter classes are used to read and write 16 bit characters. However,many fie systems use 8 bit bytes. The I/O system of Java provides numerous classes to handle 8 bit bytes. The FileInputStream and FileOutputStream are the most frequently used classes to handle bytes.

 

Reading and Writing Characters Streams in Java

The Reader and Writer class comprises various subclasses. These subclasses implement streams that can handle characters. The sub classes used to handle characters in file are FileReader and FileWriter. FileReader is used for reading characters from the file and FileWriter is used for writing character to the file.

How to create a file in Java

The creation and utilization of a disk file involve various decisions to be made, such as an appropriate naming for the file, data type to be used, purpose of creating the file and method used in the creation of file.A Filename refers to a unique string of characters that facilitates easy identification of files on the disk.

 

RandomAccessFile in Java

Random Access File means that the data can be read from or written to random location in a file. In the File class, data is read from and written sequentially as continuous streams of data. The java.io package comprises a class known as RandomAccessFile that allows performing input/ output operations to any location within a file.

 

Page 5 of 20