Professional Documents
Culture Documents
Experiment No 31 and 32
Experiment No 31 and 32
Experiment No 31 and 32
////////////////////page 151//////////////////
XII
1. Java stream classes can be categorised into two groups based on the data type one which they operate:
1. Byte streams
2. Character Streams
Classes for file operations are:
FileInputStream Input stream that reads from a file
FileOutputStream Output stream that write to a file.
FileReader Input stream that reads from a file
FileWriter Output stream that write to a file.
Methods
public abstract int read() Reads a byte and returns as a integer 0-255
public int read(byte[] buf, int offset, Reads and stores the bytes in buf starting at offset.
int count) Count is the maximum read.
public int available() Returns the number of bytes that can be read.
public void write(byte[] buf, int Write count bytes starting from offset in buf.
offset, int count)
public void write(byte[] buf) Same as previous offset=0 and count = buf.length()