java io stream simple comb

1.io flow
  concept 1) stream:
      the stream is a set of sequential, starting and ending with a collection of bytes, it is the general term for data transmission or abstract. It is characteristic of the data transmission;
  Category 2) IO stream:
      A data classified according to different types of processing: the character stream and byte stream
      B is divided into different flows based on the data: the input and output streams.
  3) Byte and character stream to identify the stream:
      character stream origin: since different coded data, and streaming objects with the efficient operation of the character. When in fact essentially based on the read byte stream, to check specified code table.
      . A different read unit: byte stream byte (8bit) units of the character stream in characters, the characters according to the code table mapping, a plurality of bytes may be read.
      . Different processed B: byte stream can handle all types of data (such as images, avi, etc.), the character stream can handle the type of character data.
      Conclusion: as long as the plain text data, it is preferred to use a character stream. In addition to use the byte stream.
  4) the input and output streams
     input stream read only, write only to the output stream (ie: read write)
     the input stream of bytes:
         a.InputStream is the parent of all the input stream of bytes, it It is an abstract class.
         b.ByteArrayInputStream, StringBufferInputStream, FileInputStream are three basic flow of the medium, respectively Byte array to read data from, the StringBuffer, and local file.
         c.PipedInputStream reads the data from shared with other threads in the pipeline.
         d.ObjectInputStream and all subclasses are decorated FilterInputStream stream (decorator pattern of lead).
     Output byte stream:
         a.OutputStream is the parent of all output byte stream, which is an abstract class.
         b.ByteArrayOutputStream, FileOutputStream are two basic flow of the medium, respectively Byte array write data to, and a local file.
         c.PipedOutputStream write data to the common conduit with the other threads.
         d.ObjectOutputStream and all subclasses are decorated FilterOutputStream flow.
     Summary:
        input stream: the InputStream or Reader: read the program from the file;
        output streams: the OutputStream or Writer: output from the program to a file;
   5) with the process flow stream node:
           Direct use of flow nodes, inconvenient to write, for faster read and write files, only the process flow.
       Node Stream: source connected directly to the data, read in or out.
               . a parent class: InputStream, OutputStream, Reader, Writer
               b file:. FileInputStream, FileOutputStrean, FileReader, FileWriter stream file processing node
               c array:. ByteArrayInputStream, ByteArrayOutputStream, flow nodes CharArrayReader, CharArrayWriter array of processing (corresponding to the file is no longer, but an array of memory ) D
               string:. StringReader, StringWriter node string processing flow
               e pipe:. PipedInputStream, PipedOutputStream, PipedReader, PipedWriter node processing pipeline stream
       processing stream: process flow stream and a node used in the nodes of the stream basis, then a layer of sheathing, the sheathing is in the process flow stream node. 
               a stream buffer:. BufferedInputStrean, BufferedOutputStream, BufferedReader, BufferedWriter increase the buffer function to avoid frequently read and write disk.
               b commutations:. InputStreamReader, OutputStreamReader conversion between byte stream and character stream.
               . C stream: DataInputStream, DataOutputStream etc. - provide basic data type is written to a file, or read out.
    Reference Bowen: https: //blog.csdn.net/zhaoyanjun6/article/details/54292148/#commentBox           
    

Published 118 original articles · won praise 59 · views 490 000 +

Guess you like

Origin blog.csdn.net/u012255097/article/details/103391114