像操作 圖檔 視訊 mp4 文檔(裡面可能有圖檔) 等等
必須使用try catch finally 來包 不用throws(流是要關閉的 如果中途抛錯 throws 無法将流關閉 浪費資源)
UTF-8編碼下 一個 中文占3個位元組 GB2312編碼下 一個中文占2個位元組
位元組流 總結起來
<code>第一步</code> 建立<code>File</code>對象
new File(String path);
new File(String parent,String child);
new File(File parent,String child)
常用的三種建立方式
<code>第二步</code>建立流
new FileInputSream(File)
new FileInputSream(String)
<code>第三步</code>讀取操作
<code>read</code>方法 <code>write</code>方法
<code>第四步</code>關閉流
一定要放到finally中
即使再小的帆也能遠航