Reader character Stream

Source: Internet
Author: User

design of reader and writer character streams:FileReader is a subclass of InputStreamReader, and InputStreamReader is a subclass of reader; FileWriter is a subclass of OutputStreamWriter, And OutputStreamWriter is the subclass of writer. The difference between a character stream and a byte stream is that the character stream operation object is an array of characters and characters, and the byte-stream operation object is an array of bytes and bytesRead file: (Reader Class)int read ();     Reads a single character int read (char[] c) from the input stream; Read (char[] c,int off,int len);      Starting from off, up to Len length, save Bvoid Close (); ReadLine ()///only suitable for reading arow ( blocking function)
Reader subclass Filreader, constructs FileReader (String name); Reader subclass BufferedReader: With buffer, avoid each time from the data source to read data, character encoding conversion; Construct Bfferedreader (Reader in)Write Text file: (writer Class)Write (string str) outputs the characters contained in the STR string to the output stream write (string str,int off,int len) close () void flush ()//Flush output stream writer subclass FileWriter, constructs FileWriter (String name);Writer sub-class BufferedWriterConstructionBufferedWriter(Writer in)

Reader character Stream

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.