BufferedReader

Constructor

BufferedReader(Reader in); 
//Creates a buffering character-input stream that uses a default-sized input buffer.

<aside> 💡 本次open method 宣告的Reader部分使用InputStreamReader來帶入

</aside>

Methods

readLine

String	readLine(); //Reads a line of text.

Returns: A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached.

<aside> 💡 readLine可以讀取一行string,不包含換行(\n),若達到最尾端則回傳null。 使用while(string ≠ null) print(string); 就能印出檔案的所有內容。

</aside>


File

Constructor

File(String pathname); 
//Creates a new File instance by converting the given pathname string into an abstract pathname.

Methods

getAbsolutePath

String	getAbsolutePath(); 
//Returns the absolute pathname string of this abstract pathname

Returns: The absolute pathname string denoting the same file or directory as this abstract pathname.