這段代碼實在是看不懂,請大神幫忙分析一下!
? ? FileInputStream fis = null;
fis = openFileInput("a.txt");
? ? ByteArrayOutputStream baos = new ByteArrayOutputStream();
? ? byte [] buffer = new byte[1024];
? ? int len=0;
? ?
while((len=fis.read(buffer))!=-1){
baos.write(buffer, 0, len);
? ? content = baos.toString();
? ?
fis.close();
baos.close();
? ? return content;
2015-11-20
就是讀取 a.txt這個文件
2016-01-22
1、首先通過輸入流獲取到本地文件的流對象。
2、通過輸出流寫入到字節數組中緩存。
3、最后字節數組轉成字符串。
4、這方面的看不懂建議去看java的IO流相關知識。