Mega Code Archive

 
Categories / Java Tutorial / File
 

Input Output

There are four types of streams: InputStream, OutputStream, Reader, and Writer. Reader. A stream to read characters. Writer. A stream to write characters. InputStream. A stream to read binary data. OutputStream. A stream to write binary data. For better performance, use the buffered I/O classes: BufferedInputStream, BufferedOutputStream, BufferedReader, and BufferedWriter. Reading from and writing to a stream dictate that you do so sequentially. The java.io.RandomAccessFile is for non-sequential operations. For object serialization and deserialization, you can use the ObjectInputStream and ObjectOutputStream classes.