JAVA IO
Introduction
Java Streams
Streams Java reads and writes data via streams A stream is a sequence of data (bytes, characters, etc… We read data from input streams We write data to output streams
Byte Streams The FileInputStream and FileOutputStreams read and write a sequence of bytes The read() method reads a byte The write() method writes a byte The close() method closes the file
Byte Streams (Example)
Character Streams Character streams work the same way as byte streams but operate on 16 bit Unicode characters The FileReader and FileWriter read and write a sequence of bytes The read() method reads a character The write() method writes a character
Web Example The InputStream class is the base class for all readers But we want to read characters which is done via the InputStreamReader So we wrap the classes
Web Example