The first day of the dark horse programmer

Source: Internet
Author: User

-------Android Training,Java TrainingWe look forward to communicating with you!
----------

Today, I watched some videos on the dark horse foundation. I felt like Miss bi was very detailed and in-depth. I knew it as soon as I saw it. I also watched other people's videos before, but I didn't understand it, what Mr. Bi said is different, so I know what it is called "knowing what it is ".

For file replication, there is a copy file in Java called Io, Io is divided into byte input stream (inputstream), byte output stream (outputstream) and character read stream (Reader) character reading stream (writer). The delimiter stream is based on the byte stream. to copy a file, you must first create a destination file, and then read the source file and write it to the delimiter stream, then refresh, that is, write the ghost stream to the destination file. Next I will introduce them in detail: they are all classes in the Java. Io package.

  • Inputstream is an abstract class that indicates the byte input stream. It has the read () method for reading bytes. If the last byte is read,-1 is returned. Close ()It is to close the input stream and release all system resources related to the stream.
  • Outputstream indicates the output byte stream. The output stream accepts the output bytes and sends them to a receiver. You need to defineOutputstreamSubclass ApplicationProgramYou must always provide at least one method that can write to one output byte. It has a write byte method that writes (byte [] B) to B. length bytes are written to the output stream from the specified byte array; flush () is used to refresh the output stream and forcibly write all buffered output bytes. Close () is to close the output stream and release all system resources related to the stream.
  • Reader is also an abstract class that reads the complete stream.Read () indicates reading a single character. Read (char [] cbuf, int off, int Len) reads characters into a part of the array. Close () closes the stream and releases all associated resources.
  • Writer is the abstract class that writes data into the livestream. Write (char [] cbuf, int off, int Len) writes a part of the character array. Write (string Str) writes a string. Write (string STR, int off, int Len) writes a part of the string. Close () to close the stream, but refresh it first. Flush () refreshes the buffer of the stream.

 The above are some of the common methods in these four base classes. It is no problem to compare them with its API documentation and then perform more training to write some of the most basic I/O statements.

 

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.