java 如何高速解压缩

2024-10-13 17:10:41

1、/***递归压缩文件夹*@paramsrcRootDir压缩文件夹根目录的子路径*@paramfile当前递归压缩的文件或目录对象*@paramzos压缩文件存储对象*@throwsException*/privatestaticvoidzip(StringsrcRootDir,Filefile,ZipOutputStreamzos)throwsException{if(file==null){return;}

java 如何高速解压缩

3、subPath=subPath.substring(srcRootDir.length()+File.separator.length());}ZipEntryentry=newZipEntry(subPath);zos.putNextEntry(entry);BufferedInputStreambis=newBufferedInputStream(newFileInputStream(file));while((count=bis.read(data,0,bufferLen))!=-1){zos.write(data,0,count);}bis.close();zos.closeEntry();}//如果是目录,则压缩整个目录else{

java 如何高速解压缩

5、 publicstaticvoidzip(StringsrcPath,StringzipPath,StringzipFileName)throwsException{if(StringUtils.isEmpty(srcPath)||StringUtils.isEmpty(zipPath)||StringUtils.isEmpty(zipFileName)){thrownewParameterException(ICommonResultCode.PARAMETER_IS_NULL);}CheckedOutputStreamcos=null;ZipOutputStreamzos=null;try{FilesrcFile=newFile(srcPath);

java 如何高速解压缩
猜你喜欢