当前位置: 首页 > news >正文

河北 石家庄 网站建设营销外包团队有哪些

河北 石家庄 网站建设,营销外包团队有哪些,手机qq插件wordpress,怎样用jsp做网站Java API中的import java.util.zip.*;包下包含了Java对于压缩文件的所有相关操作。我们可以使用该包中的方法#xff0c;结合IO中的相关知识#xff0c;进行文件的压缩和解压缩相关操作。ZipFilejava中的每一个压缩文件都是可以使用ZipFile来进行表示的。File file new File…Java API中的import java.util.zip.*;包下包含了Java对于压缩文件的所有相关操作。我们可以使用该包中的方法结合IO中的相关知识进行文件的压缩和解压缩相关操作。ZipFilejava中的每一个压缩文件都是可以使用ZipFile来进行表示的。File file new File(F:/zippath.zip);ZipFile zipFile newZipFile(file);System.out.println(压缩文件的名称为 zipFile.getName());压缩单个文件/**压缩单个文件*/public static voidZipFile(String filepath ,String zippath) {try{File file newFile(filepath);File zipFile newFile(zippath);InputStream input newFileInputStream(file);ZipOutputStream zipOut new ZipOutputStream(newFileOutputStream(zipFile));zipOut.putNextEntry(newZipEntry(file.getName()));int temp 0;while((temp input.read()) ! -1){zipOut.write(temp);}input.close();zipOut.close();}catch(Exception e) {e.printStackTrace();}}应用ZipFile(d:/hello.txt, d:/hello.zip);压缩多个文件(文件夹)/**一次性压缩多个文件文件存放至一个文件夹中*/public static voidZipMultiFile(String filepath ,String zippath) {try{File file new File(filepath);//要被压缩的文件夹File zipFile newFile(zippath);InputStream input null;ZipOutputStream zipOut new ZipOutputStream(newFileOutputStream(zipFile));if(file.isDirectory()){File[] filesfile.listFiles();for(int i 0; i files.length; i){input newFileInputStream(files[i]);zipOut.putNextEntry(new ZipEntry(file.getName() File.separator files[i].getName()));int temp 0;while((temp input.read()) ! -1){zipOut.write(temp);}input.close();}}zipOut.close();}catch(Exception e) {e.printStackTrace();}}应用ZipMultiFile(f:/uu, f:/zippath.zip);解压缩单个文件/**解压缩(解压缩单个文件)*/public static voidZipContraFile(String zippath ,String outfilepath ,String filename) {try{File file new File(zippath);//压缩文件路径和文件名File outFile new File(outfilepath);//解压后路径和文件名ZipFile zipFile newZipFile(file);ZipEntry entry zipFile.getEntry(filename);//所解压的文件名InputStream input zipFile.getInputStream(entry);OutputStream output newFileOutputStream(outFile);int temp 0;while((temp input.read()) ! -1){output.write(temp);}input.close();output.close();}catch(Exception e) {e.printStackTrace();}}应用ZipContraFile(d:/hello.zip,d:/eee.txt, hello.txt);解压缩多个文件ZipInputStream类当我们需要解压缩多个文件的时候ZipEntry就无法使用了。如果想操作更加复杂的压缩文件我们就必须使用ZipInputStream类。/**解压缩(压缩文件中包含多个文件)可代替上面的方法使用。* ZipInputStream类* 当我们需要解压缩多个文件的时候ZipEntry就无法使用了* 如果想操作更加复杂的压缩文件我们就必须使用ZipInputStream类**/public static voidZipContraMultiFile(String zippath ,String outzippath){try{File file newFile(zippath);File outFile null;ZipFile zipFile newZipFile(file);ZipInputStream zipInput new ZipInputStream(newFileInputStream(file));ZipEntry entry null;InputStream input null;OutputStream output null;while((entry zipInput.getNextEntry()) ! null){System.out.println(解压缩 entry.getName() 文件);outFile new File(outzippath File.separator entry.getName());if(!outFile.getParentFile().exists()){outFile.getParentFile().mkdir();}if(!outFile.exists()){outFile.createNewFile();}inputzipFile.getInputStream(entry);output newFileOutputStream(outFile);int temp 0;while((temp input.read()) ! -1){output.write(temp);}input.close();output.close();}}catch(Exception e) {e.printStackTrace();}}应用ZipContraMultiFile(f:/zippath.zip, d:/);ZipContraMultiFile(d:/hello.zip, d:/);
http://wiki.neutronadmin.com/news/435465/

相关文章:

  • 有哪些推广网站优秀的软文广告案例
  • 如何创建一个国外免费网站移动应用开发大专出来做什么
  • 做网站的维护成本上海快速优化排名
  • 单页面网站推广qq营销网站源码
  • 锡盟建设局网站潍坊专业舞蹈学校
  • 响应式网站模板html5建筑公司网站页面图片
  • 建设网站排名网页生成pdf
  • 福州网络营销网站网站信息抽查评估
  • 网站推广排名平台wordpress 树莓派
  • 厦门比较好的网站设计公司上海企业网站模板
  • 网站规划与建设步骤南通建设招聘信息网站
  • 仿做唯品会网站网站尾部设计
  • 台州网站关键字优化详情鹤岗市建设局网站
  • 无锡网站关键词推广百度网站怎么优化排名
  • seo推广网站番禺人才网官方网站信息公布
  • 网站建设的相关新闻能利用双股铜芯电话线做网站吗
  • 电子商务网站建设教程 pdfc 博客网站开发教程
  • 帮忙做任务网站手机网页视频怎么下载
  • 免费下载简历模板网站小程序开发教程图书
  • 专业建设信息化网站资源计生网站生育文明建设
  • 网站策划书的撰写流程?惠州网络营销
  • 遵化市城乡建设局网站 上的网站app
  • 外贸俄罗斯俄语网站制作外国高端网站设计
  • 十大小说网站排名动态logo在线制作
  • 网站开发入哪个会计科目哪个网站可以做水果销售代理
  • 苏州网站维护简单的个人网站
  • 网站全站建设开题报告范文汕头第一网
  • 艾迪网络专业的网站建设公司搜狗推广登录
  • 天津seo网站管理企业对电子商务网站的建设
  • 建设个人网站需要备案吗商城网站的模块设计