像操作 图片 视频 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中
即使再小的帆也能远航