by Dinesh Thakur Category: Stream

We use two classes FileInputStream, FileOutputStream i.e to read data from one file and write it to another file.

 
by Dinesh Thakur Category: Stream

The java.io.BufferedReader and java.io.BufferedWriter classes are the character based equivalents of the byte oriented BufferedlnputStream and BufferedOutputStream classes.



 
by Dinesh Thakur Category: Stream

Byte stream classes are used to perform reading and writing of 8-bit bytes. Streams being unidirectional in nature can transfer bytes in one direction only, that is, either reading data from the source into a program or writing data from a program to the destination. Therefore, Java further divides byte stream classes into two classes, namely, InputStream class and OutputStrearn class. The subclasses of InputStrearn class contain methods to support input and the subclasses of OutputStrearn class contain output related methods.

 
by Dinesh Thakur Category: Stream

Java also allows you to access the contents of a file in random order i.e. data items can be read and written in any order. This is especially useful in direct access applications such as banking systems, airline reservation systems, Automatic Teller Machine (ATM) etc. where the desired information must be located immediately. Random access files (or direct access files) are analogous to arrays, where each element is accessed directly by means of its index number. Java provides java.io.RandomAccessFile class that enables you to perform random access file input and output operations as opposed to sequential file I/O offered by ByteStream and CharacterStream classes.



 
by Dinesh Thakur Category: Stream

The BitSet class is used to create objects that maintain a set of bits. The bits are maintained as a growable set. The capacity of the bit set is increased as needed. Bit sets are used to maintain a list of flags that indicate the state of each element of a set of conditions. Flags are boolean values that are used to represent the state of an object. It is used for representing a set of true and false values.

 
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

One of the limitations of byte stream classes is that it can handle only 8-bit bytes and cannot work directly with Unicode characters. To overcome this limitation, character stream classes have been introduced in java.io package to match the byte stream classes. The character stream classes support 16-bit Unicode characters, performing operations on characters, character arrays, or strings, reading or writing buffer at a time. Character stream classes are divided into two stream classes namely, Reader class and Writer class.



 
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.

 
by Dinesh Thakur Category: Stream

Java provides java.io.FileReader and java.io.FileWriter classes for reading from and writing characters to a file. The FileReader and FileWri ter classes can be used almost identically to the FileInputStream and FileOutputStream character stream classes.



 

Page 1 of 6

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.



Search Content







Popular Article