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

新疆建设网 工程信息网站搜索引擎有哪些种类

新疆建设网 工程信息网站,搜索引擎有哪些种类,wordpress最大上传2g,旬阳县建设局网站随时随地阅读更多技术实战干货,获取项目源码、学习资料,请关注源代码社区公众号(ydmsq666) 前面介绍的使用第三方的jar进行压缩,下面介绍使用jdk自带的方法进行压缩: Test: package com.home;import java.io.IOExcep…

随时随地技术实战干货,获取项目源码、学习资料,请关注源代码社区公众号(ydmsq666)

前面介绍的使用第三方的jar进行压缩,下面介绍使用jdk自带的方法进行压缩:

Test:

package com.home;import java.io.IOException;public class Test {public Test() {try {ZipUtil.doZip("D://test", "D://test1.zip");// 压缩整个文件来ZipUtil.doZip("D://test.doc", "D://test2.zip");// 压缩单个文件} catch (IOException e) {e.printStackTrace();}}public static void main(String[] args) {new Test();}}

ZipUtil:

package com.home;import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;public class ZipUtil {/*** 压缩的接口* * @param src*            源文件全路径* @param des*            目标zip文件全路径* @throws IOException*/public static void doZip(String src, String des) throws IOException {File srcFile = new File(src);// 源文件File zipFile = new File(des);// 目标zip文件ZipOutputStream zos = null;try {zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile)));String basePath = null;if (srcFile.isDirectory()) {basePath = srcFile.getPath();} else {basePath = srcFile.getParent();}zipFile(srcFile, basePath, zos);} finally {if (zos != null) {zos.closeEntry();zos.close();}}}/*** 压缩文件* * @param srcFile* @param basePath* @param zos* @throws IOException*/private static void zipFile(File srcFile, String basePath,ZipOutputStream zos) throws IOException {File[] files = null;if (srcFile.isDirectory()) {files = srcFile.listFiles();} else {files = new File[1];files[0] = srcFile;}BufferedInputStream bis = null;String pathName;byte[] buf = new byte[1024];int len = 0;try {for (File file : files) {if (file.isDirectory()) {if (!basePath.endsWith("\\")) {basePath += "\\";}pathName = file.getPath().substring(basePath.length())+ "\\";zos.putNextEntry(new ZipEntry(pathName));zipFile(file, basePath, zos);} else {if (!basePath.endsWith("\\")) {basePath += "\\";}pathName = file.getPath().substring(basePath.length());bis = new BufferedInputStream(new FileInputStream(file));zos.putNextEntry(new ZipEntry(pathName));while ((len = bis.read(buf)) > 0) {zos.write(buf, 0, len);}}}} finally {if (bis != null) {bis.close();}}}}



 

http://www.lbrq.cn/news/2385055.html

相关文章:

  • 新余专业做淘宝网站东莞seo整站优化火速
  • 企业网站建设的思路北京网站seo招聘
  • 微信如何开发小程序青岛seo优化
  • 网站开发技术经理职责友情链接可以帮助店铺提高浏览量
  • 免费erp系统网站外部优化的4大重点
  • 营销型网站建设哪里有东莞seo管理
  • 重庆建设工程信息网站友情链接大全
  • 网站托管公司哪家好营销策划公司名称
  • 成品网站源码1688的优势四川seo优化
  • php语言网站开发五年级下册数学优化设计答案
  • 网站制作哪家大游戏推广怎么做
  • 帮一个企业做网站流程广东seo推广费用
  • 国外做科研的网站医疗器械龙头股
  • 淄博定制网站建设公司人民日报评网络暴力
  • 做网站如何安全 博客搜狗站长
  • 网站制作合同大庆黄页查询电话
  • seo网站沙盒期网盟推广
  • html5 3d网站郑州做网站推广电话
  • 赵艳红网站建设规划全网营销整合营销
  • 张家港网站制作公司网络销售工作靠谱吗
  • 网站备案跟域名有什么关系怎么创建一个网址
  • dedecms做论坛网站百度推广客户端下载网址
  • 企事业网站建设南通关键词优化平台
  • 我自己做的网站上有图片宣传食品常用的关键词有哪些
  • 深圳网站建设定制免费网站推广软文发布
  • 做招聘信息的网站有哪些软文素材网站
  • 优化网站制作方法大全中央新闻联播
  • 邯郸营销网站建设域名网站查询
  • 乌鲁木齐本地网站设计公司企业网站
  • 韩国原生ip站群服务器百度推广app下载官方
  • ThreadLocal 在 Spring 与数据库交互中的应用笔记
  • 从“代码工坊“到“思维引擎“:Claude Code如何重塑编程权力结构
  • Java 核心工具类 API 详解(一):从 Math 到 Runtime 的实用指南
  • [Linux]如何設置靜態IP位址?
  • c语言笔记---结构体
  • Instagram千号矩阵:亚矩阵云手机破解设备指纹检测的终极方案