How far can we go series (1)
"How far can we go": start my java journey. I want to dig out this authentic and leave here.
Io entryCodeRead:
Byte stream:
Private Void Writetxt (string path, string value) Throws Ioexception {outputstream fos = New Fileoutputstream (PATH ); // Constructor 1 FOS. Write (value. getbytes (); FOS. Close ();} Private Void Readtxt (string path) Throws Ioexception {file File = New File (PATH); inputstream FCM = New Fileinputstream (PATH ); // Constructor 2 Byte B [] = New Byte [( Int ) File. Length ()]; FCM. Read (B); system. Out. Print ( New String (B); FCM. Close ();}
Ghost stream:
Private Void Writetxt (string path, string value) Throws Ioexception {writer = New Filewriter (PATH); writer. Write (value); writer. Close ();} Private Void Readtxt (string path) Throws Ioexception {reader Reader =New Filereader (PATH ); Char C [] = New Char [1024 ]; Int Len = Reader. Read (c); system. Out. Print ( New String (C, 0 , Len); reader. Close ();}