本帖最后由 李娟 于 2011-12-23 23:07 编辑
public static void splitFile()throws IOException
{
FileInputStream fis = new FileInputStream("d:\\java\\1.bmp");
FileOutputStream fos = null;
byte[] buf = new byte[1024*1024];
int len = 0;
int count = 1;
while((len=fis.read(buf))!=-1)
{
fos = new FileOutputStream("d:\\java\\splitfiles"+(count++)+".part");
fos.write(buf,0,len);
fos.close();
}
fis.close();
}//运行程序,但是出不来效果 |
|