Site hosted by Angelfire.com: Build your free website today!
 

Type of I/O

Table 1. Memory

CharArrayReader, CharArrayWriter, ByteArrayInputStream, ByteArrayOutputStreamUse to read from and write to mempory. You create these streams on an existing array and then use the read/write methods to read/write to the array.
StringReader, StringWriter, StringBufferInputStreamUse StringReader to read characters from a String in memory. Use StringWriter to write to a String. StringWriter collects the characters written to it in a StringBuffer, which can then be converted to a String.

StringBufferInputStream is similar to StringReader, except that it reads bytes from a StringBuffer.

Table 2. Pipe

PipedReader, PipedWriter, PipedInputStream, PipedOutputStreamImplement the input and output components of a pipe. Pipes are used to channel the output from one thread into the input of another.

Table 3. File

FileReader, FileWriter, FileInputStream, FileOutputStreamCollectively called file streams, these streams are used to read from or write to a file on the native file system.

Table 4. Concatenation

SequenceInputStreamConcatenates multiple input streams into one input stream.

Table 5. Object Serialization

ObjectInputStream, ObjectOutputStreamUsed to serialize objects.

Table 6. Data Conversion

DataInputStream, DataOutputStreamRead or write primitive data types in a machine-independent format.

Table 7. Counting

LineNumberReader, LineNumberInputStreamKeeps track of line numbers while reading.

Table 8. Peek Ahead

PushbackReader, PushbackInputStreamThese input streams each have a pushback buffer. When reading data from a stream, it is sometimes useful to peek at the next few bytes or characters in the stream to decide what to do next.

Table 9. Printing

PrintWriter, PrintStreamContain convenient printing methods. These are the easiest streams to write to, so you will often see other writable streams wrapped in one of these.

Table 10. Buffering

BufferedReader, BufferedWriter, BufferedInputStream, BufferedOutputStreamBuffer data while reading or writing, thereby reducing the number of accesses required on the original data source. Buffered streams are typically more efficient than similar nonbuffered streams and are often used with other streams.

Table 11. Filtering

FilterReader, FilterWriter, FilterInputStream, FilterOutputStreamThese abstract classes define the interface for filter streams, which filter data as it's being read or written.

Table 12. Byte/Char Conversion

InputStreamReader, OutputStreamWriter

A reader and writer pair that forms the bridge between byte streams and character streams.

An InputStreamReader reads bytes from an InputStream and converts them to characters, using the default character encoding or a character encoding specified by name.

An OutputStreamWriter converts characters to bytes, using the default character encoding or a character encoding specified by name and then writes those bytes to an OutputStream.

You can get the name of the default character encoding by calling System.getProperty("file.encoding").