Free to nothing, revisit horse soldier Teacher's Java Foundation ...
Stream of flowing stream rogue stream, stream in English called Stream, stream
Classification of streams:
Streams are used to read and write data.
Flow is like water, the fileclass encapsulates the name of the document, it is an object in memory , OK, but the real file is a space on the hard disk, in this file, there are a variety of data, then we want to read this data how to do? Read it this way, through a stream.
For example, if this is our document, we want to read the data from the program, we all know, for the computer, you read any data is what kind of form, is not all 010101 of these forms, right.
How about this? Read the contents of these files and you can think of this as a small bucket. The file is a bucket, how do you get the water from the bucket? Or how to take data from the file inside, the common way is this, we get a pipe godless to the bucket, and then put this pipe, bang , a godless , godless to the top of the barrel, this side open the faucet, began to water, which is called flow, what is called flow, This pipe is called flow , the flow crashed and crashed out, this is called flow, Java input and output, and the same flow, when you want to take data from the file, a pipe crashed godless up, and then follow this pipeline, you start to read the data.
You're going to write the data in it? In turn, crashed a pipe godless up, from the end of the pipeline to start 咵 咵 pumping to the inside of irrigation.
In addition to you can read and write data from the file, you can also from the network, such as the pipe 咵 from my machine godless to your machine, I said a word, you have to hold. If you say a word, I'll put it on my side. Ok?
Sometimes a pipe is not enough, for example, the pipe read the water, there are impurities, outside to wrap a layer of pipe, for example, you read over the data, the most original data is certainly 010101, a byte of a byte to read out, When you read like this, you don't think this is the right way to go. Wrap a powerful pipe outside, this pipe can be 010101 converted to a string, bang when read out, the pipeline is wrapped in the outside of the original pipeline, this is the flow of input and output, these pipelines are Java flow.
Classification of streams:
Depending on the angle of the different types, the IO package defines all the streams.
Input stream or output stream division: are standing in the point of view of the program play, relative to the program.
Bytes Stream or character stream:
BYTE stream: The most primitive of a stream, read the data is 010101, just read in bytes, a byte is 8 bits.
Characters Stream: One character is read out, and the character is 2 bytes. Inside Java is a Unicode string with a character that is 2 bytes. Utf16 OK
node stream or process flow:
Node stream: This pipe godless directly to the stream on the data source.
Process Flow: A stream that is set on top of another pipe.
All that end with stream is a byte stream, the most primitive way to read data, one byte at a time.
Introduction to the IO stream of happy in Java