文件的切割与合并(视频文件或者压缩文件)
来源:互联网 发布:淘宝客内部优惠券 编辑:程序博客网 时间:2024/05/19 20:58
public class Test {public static void main(String[] args) throws IOException {// TODO Auto-generated method stubtry {segmentation(); //文件的切割aggregation(); //文件的合并} catch (IOException e) {e.printStackTrace();}}public static void segmentation() throws IOException{//选中的文件地址是 D:\soft\screencapture.zip 大小为197MBFile file=new File("D:\\soft\\screencapture.zip");InputStream in=new FileInputStream(file);OutputStream out=null;byte[] bytes=new byte[(int) (file.length()/5)+1];System.out.println(file.length());for (int i = 0; i < 5; i++) {File file2 =new File("D:\\soft\\screencapture"+i+".zip");out=new FileOutputStream(file2);int len=in.read(bytes);out.write(bytes,0,len);}out.close();in.close();}public static void aggregation() throws IOException{InputStream in=null;OutputStream out=null;for (int i = 0; i < 5; i++) {File file =new File("D:\\soft\\screencapture"+i+".zip");in =new FileInputStream(file);out=new FileOutputStream("D:\\soft\\新.zip",true);int len =-1;byte[] b =new byte[10240];while ((len=in.read(b))!=-1) {out.write(b, 0, len);}}out.close();in.close();}}
0 0
- 文件的切割与合并(视频文件或者压缩文件)
- 文件的切割与合并
- 文件的切割与合并
- 文件切割与合并
- 文件切割与合并
- 黑马程序员-文件的切割与合并
- 文件的切割与合并练习
- 大文件的切割与合并
- Linux大文件的切割与合并
- SequenceInputStream 实现文件的切割与合并
- File类文件的切割与合并
- java 文件切割与合并
- java文件切割与合并
- Linux 下大型容量文件的切割与合并
- IO流 应用: 文件的 切割与合并
- 黑马程序员——文件的切割,与合并
- 黑马程序员—文件的切割与合并
- 黑马程序员——文件的切割与合并
- Java简明总结(三)
- Problem I: 约素
- 一飞智控CEO齐俊桐:一篇文章教你看透无人机飞控这十年
- React Native中的CSS的三种使用方式
- 四大组件之首-Activity
- 文件的切割与合并(视频文件或者压缩文件)
- C++抽象编程——STL(2)——stack类
- vgg16 包括网络参数的导入
- pandas易混点归纳
- 第一天学习JDBC(2)-批处理、配置文件
- 一个简单的Android自定义view详解
- android Spinner控件详解
- IO
- 三种方法求最大公约数