Escrito por wpjr2 em Maio 3, 2008
| Type of I/O |
Streams |
Description |
| Memory |
CharArrayReader
CharArrayWriter
ByteArrayInputStream
ByteArrayOutputStream |
Read from and write to memory. Create on an existing array and then use the read and write methods to read from or write to the array. |
| Memory |
StringReader
StringWriter
StringBufferInputStream |
top>StringReader reads characters from a String in memory.StringWriter writes to a String, collecting 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. |
| Pipe |
PipedReader
PipedWriter
PipedInputStream
PipedOutputStream |
Implement the input and output components of a pipe. Pipes are used to channel the output from one thread into the input of another. |
| File |
FileReader
FileWriter
FileInputStream
FileOutputStream |
Collectively called file streams, these streams are used to read from or write to a file on the native file system. |
| Concatenation |
N/A
SequenceInputStream |
Concatenates multiple input streams into one input stream. |
| Object Serialization |
N/A
ObjectInputStream
ObjectOutputStream |
Used to serialize objects. |
Data
Conversion |
N/A
DataInputStream
DataOutputStream |
Read or write primitive data types in a machine-independent format. |
| Counting |
LineNumberReader
LineNumberInputStream |
Keeps track of line numbers while reading. |
| Peeking Ahead |
PushbackReader
PushbackInputStream |
These 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. |
| Printing |
PrintWriter
PrintStream |
Contain convenient printing methods. These are the easiest streams to write to, so you will often see other writable streams wrapped in one of these. |
| Buffering |
BufferedReader
BufferedWriter
BufferedInputStream
BufferedOutputStream |
Buffer 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. |
| Filters |
FilterReader
FilterWriter
FilterInputStream
FilterOutputStream |
These abstract classes define the interface for filter streams, which filter data as it’s being read or written. |
| Convert |
InputStreamReader
OutputStreamWriter |
Convert byte streams to character streams, and vice-versa.InputStreamReaders read bytes from InputStreams and convert them to characters. OutputStreamWriters convert characters to bytes and write to an OutputStream. Default character encodings are stored in System.getProperty(”file.encoding”). |
Esta entrada foi publicada em Maio 3, 2008 às 2:04 pm e é arquivado em Curso de Programação Java, Uncategorized.
Tagged: E/S, IO, Streams.
Você pode seguir qualquer respostas para esta entrada através de RSS 2.0 feed.
Você pode deixe uma resposta, ou trackback do seu próprio site.