Java Fundamentals Secondary Learning--eighth chapter flow

Source: Internet
Author: User

Chapter Eighth Flow   time: April 28, 2017 11:03:07~2017 April 28 11:41:54 Chapters: Chapter 08, section _01 Video Length: 21:15 content: IO preliminaryExperience:all the flow in the Java.io package.defines multiple stream types (classes or abstract classes) to implement input/output functionsit can be categorized from different angles.can be divided into input stream and output stream according to different direction of data flowcan be divided into byte stream and character stream according to different units of processing datacan be divided into node stream and processing flow according to different functionsall flow types provided in the JDK are in package java.io and inherit from the following four abstract stream types respectivelyinput stream InputStream Reader (character)output stream OutputStream Writer (character) the byte stream is 01010101 reads, 1 bytes per read (8 bits)the character stream is a character that reads 1 characters per character = 2 bytes The node stream is directly connected to the program that can read and write data from a characteristic data source (node) (for example: file, memory)a process flow is a "connection" over an existing stream (a node or process stream) that provides a more powerful read and write capability to the program by processing the dataGraphic Display

   InputStream 

OutputStream

 Reader

Writer

  time: April 28, 2017 11:42:08~2017 April 28 13:45:03 Chapters: Chapter 08, section _02 Video Length: 11:34 content: Fileinputstream_fileoutputstreamNEW:node Stream type

 Copying of files FileInputStream in = null;FileOutputStream out = null;try{in = new FileInputStream ("D:/java/testfileinput.java");//file to be readout =new fileoutputstream ("D:/java/testfileoutput.java");//file to be writtenWhile ((B=in.read ())! =-1) {Out.write (b);}in.close ();out.close ().... After that, Cath will not write.}The read bytes are stored in B and then written to out.   time: April 28, 2017 13:45:33~2017 April 28 13:49:56 Chapters: Chapter 08, section _03 Video Length: 05:10 contents: FileReader and FileWriterExperience:just like the top .int c= 0;FileReader fr =null;fr=new FileReader ("file address")While ((C=fr.read ())! =-1) {System.out.print ((char) c)}  time: April 28, 2017 13:50:16~2017 April 28 14:02:58 Chapters: 08 Chapters _04 08 Chapters _05 Festival Video Length: 13:32 + 1:18 Content: Bufferedio + io_faq Experience:Process Flowa process flow is a "connection" over an existing stream (a node or process stream) that provides a more powerful read and write capability to the program by processing the data

time: April 28, 2017 14:05:22~2017 April 28 14:24:46 Chapters: Chapter 08, section _06 Video Length: 22:06 content: TransformioExperience:Convert Stream

you can convert a byte stream and a character stream from one to the otheroutputstreamwriter osw =new outputstreamwriter (new FileOutputStream ("..."))convert a byte stream to a character stream returns a stream of characters

true is the delegate appended to the original file, followed by writingIf you don't write true, you'll erase the original content. the 3rd parameter "iso-8859-1" is a specified character encoding latin-1 

system.in//-blocking method, also synchronous method  time: April 28, 2017 14:24:53~2017 April 28 14:40:24 Chapters: Chapter 08, section _07 Video Length: 18:40 content: Dataio bytearrayioExperience:

 Note that first, read it first.(FIFO)--Queue(Advanced post-out)--Stack  Time: April 28, 2017 14:40:39~ April 28, 2017 14:50:39 Chapters: Chapter 08, section _08 Video Length: 21:21 content: Print streamExperience:the print flow is only wtrite and out because it is printed out 

note system.setout, changing the location of the printThe original default is print on the consoleIt's changed to print to a file.

 the console parameter is the file namethen one line of print comes out to the console

writes the console input text to a fileand then doing some processing is a simple log file record.It's also a blocking type.  Time: April 28, 2017 14:50:39 ~ April 28, 2017 15:00:14 Chapters: Chapter 08, section _09 Video Length: 13:06 content: Objectio streamExperience:writes or reads objects directly (object)

 

Java Fundamentals Secondary Learning--eighth chapter flow

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.