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