文件的切割与合并(视频文件或者压缩文件)
2017-03-22 21:57
429 查看
public class Test { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub try { segmentation(); //文件的切割 aggregation(); //文件的合并 } catch (IOException e) { e.printStackTrace(); } } public static void segmentation() throws IOException{ //选中的文件地址是 D:\soft\screencapture.zip 大小为197MB File 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(); } }
相关文章推荐
- 黑马程序员-----file文件切割与合并(黑马视频)
- 黑马程序员-JAVA高级视频_IO输入与输出-20天-9(切割合并文件)
- 文件切割合并器6.0&nbsp;下载和使用视频…
- 日常工具,js文件压缩合并
- 带rmvb多个音视频文件合并,播放异常问题(thinkvd开发日志)
- 压缩与解压缩 与多个安装文件的合并问题
- 解决关于“这个压缩文件格式未知或者数据已经被损坏”
- C#写的文件切割合并程序
- 用shell 或者 awk 合并两个文件
- 将压缩文件与图片合并
- 【整理收藏】合并、压缩JS、CSS文件减少页面HTTP请求数的方法
- 在服务端合并和压缩JavaScript和CSS文件
- 文件切割/合并工具
- 用 rake 合并多个 JS 文件,并且用 Google Closure Compiler 压缩代码
- 关于 flash (jw player)不能处理 flv视频 中文名文件 或者 中文路径 的 解决方案
- 使用RMA进行分离合并rmvb音频、视频文件
- 自己以前用C#写的简单升级程序源码(比如更新一个安装包或者压缩文件),带进度条,支持续传
- 从MPG切割,合并到转换成FLV视频过程中可能遇到的一些问题(主要用到mencoder ffmpeg flvtool2)
- 在Linux下面去压缩文件或者目录
- android之MediaPlayer播放音频或者视频文件