黑马程序员技术交流社区
标题:
切割文件分享一下
[打印本页]
作者:
liufeibo
时间:
2015-9-10 09:42
标题:
切割文件分享一下
//把一个文件切割成n个文件
import java.io.*;
class SplitDemo
{
public static void main(String[] args) throws IOException
{
method_1();
}
public static void method_1() throws IOException
{
BufferedInputStream br = new BufferedInputStream(new FileInputStream("E:\\demo1\\4.txt"));
FileOutputStream fw = null;
byte[] by = new byte[10*1024];
int len=0;
int count=1;
while((len=br.read(by))!=-1)
{
fw=new FileOutputStream("E:\\demo1\\"+(count++)+".part");
fw.write(by,0,len);
fw.close();
}
br.close();
}
}
作者:
大木木
时间:
2015-9-10 15:49
是把文本文档的内容分开写入几个文档里?
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2