Input and output stream of Android learning notes

Source: Internet
Author: User

One: Write data to local resources (character stream)

ImportJava.io.FileWriter;
ImportJava.io.IOException;

/**
* Created by Ahtcfg24 on 2015/3/30.
*/
public class outputstreamdemo
{
public static void main (string[] args) throws Ioexception//
{
FileWriter FW = New filewriter ( " you're a tease .. txt "); //call the construct method, build a Stream object, generate the name you are the tease . txtof the file

FW. Write (" haha haha"); //calledFileWriteclass inside theWritemethod to write data into the stream object.
/ * data is still stored in the stream, not in the file */
FW. Flush (); //calledFlushmethod refreshes the stream, and after the refresh, the data is passed to the file,stream not closed at this time
FW. Write (", You are tease "); Stream does not close still can pass in data to the stream
FW. Close (); call the close method to refresh the stream data first, and then close the stream
}
}

?

Two: operation of Array (byte stream)

Input and output stream of the Android learning note

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.