Java IO Tutorial
Java io package provides for system input and output through data streams, serialization and the file system.
IO Streams are the core concept of Java IO. A stream is a conceptually endless flow of data. You can either read from a stream or write to a stream. A stream is connected to a data source or a data destination. Streams in Java IO can be either byte based or character based .
Input and Output - Source and Destination
The input of an application is often the output of another. Is an OutputStream a stream where output is written to, or output comes out from.After all, an InputStream outputs its data to the reading program, doesn't it is Personally, I found this a bit confusing back in the day when I first started out learning about Java IO.
Java's IO package is used to reading of raw data from a source and writing of raw data to a destination. The most typical sources and destinations of data are these.
Java IO Features
Java IO contains many of the InputStream, OutputStream, Reader and Writer subclasses.All of these subclasses are addressing various different purposes. That is why there are so many different classes. The purposes addressed are summarized below:
|Byte Based Input||Output||Character Based Input||Output|
|Basic||Inputstream||Outputstream||Reader InputStreamReader||Writer OutputStreamWriter|
|Files||FileInputStream RandomAccessFile||FileOutputStream RandomAccessFile||FileReader||FileWriter|
|Parsing||PushbackInputStream StreamTokenizer||PushbackReader LineNumberReader|
|Data - Formatted||PrintStream||PrintWriter|