I don't want to take others' things as my own, but I want to make it easier for future reference or excerpt.
Reading Java programming ideology 3 or 4, I feel that foreigners write books differently from reading books. I always feel that what foreigners write is like writing a manual, which is comprehensive but cumbersome.
[Principle] Don't tell me history. Just tell me how to do it.
[Fact] the output input class is simple for TMD. Why do I have to make a manual so that this cainiao doesn't understand it?
[Thanks] Summary of the Chinese IT lab
----------------------------------------------------------
Basic concepts of Data Flow
Understanding data streams is generally divided into two types: input stream and output stream. However, this division is not absolute. For example, when a file writes data to it, it is an output stream; when reading data from it, it is an input stream. Of course, the keyboard is just a few people, while the screen is just an output stream.
Java standard data stream
Standard input/output refers to the interaction between programs and systems in character mode (such as DoS:
Standard Input studin, the object is the keyboard.
Standard output stdout, the object is the screen.
Stderr is output with standard errors, and the object is also a screen.
For example, 8.1 enter characters from the keyboard.
This example uses system. in. read (buffer) input a line of characters from the keyboard, stored in the buffer, Count stores the number of bytes actually read, and then outputs the value in the buffer in integer and character ways. The read method is in the Java. Io package, and an ioexception must be thrown. The procedure is as follows:
Import java. Io .*;
Public class input1
{
Public static void main (string ARGs []) throws ioexception
{
System. Out. println ("input :");
Byte buffer [] = new byte [512]; // input buffer
Int COUNT = system. In. Read (buffer); // read the standard input stream
System. Out. println ("output :");
For (INT I = 0; I <count; I ++) outputs the buffer element value
{
System. Out. Print ("" + buffer [I]);
}
System. Out. println ();
For (INT I = 0; I <count; I ++) Outputs buffer in Character Mode
{
System. Out. Print (char) buffer [I]);
}
System. Out. println ("Count =" + count); // actual buffer Length
}
}
In the program, the main method throws an ioexception using the throws clause and is handled by the system.
Data streams and file classes in Java. Io packages
Byte stream:
A series of classes derived from inputstream and outputstream. This type of stream is measured in bytes.
Inputstream and outputstream
◇ Fileinputstream and fileoutputstream
◇ Pipedinputstream and pipedoutputstream
◇ Bytearrayinputstream and bytearrayoutputstream
◇ Filterinputstream and filteroutputstream
◇ Datainputstream and dataoutputstream
◇ Bufferedinputstream and bufferedoutputstream
Ghost stream:
A series of classes derived from Reader and writer. These streams use 16-bit Unicode characters as the basic processing unit.
Reader and writer
◇ Inputstreamreader and outputstreamwriter
◇ Filereader and filewriter
◇ Chararrayreader and chararraywriter
◇ Pipedreader and pipedwriter
◇ Filterreader and filterwriter
◇ Bufferedreader and bufferedwriter
◇ Stringreader and stringwriter