首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏CODING DevOps

    给大型机插上翅膀,IBM Zos 研发团队 DevOps 转型实践

    但见新人笑,哪闻旧人哭,杜甫的诗句很好的诠释了现在 IT 和互联网行业对待技术的态度,区块链、AI、大数据、AR/VR 等新技术层出不穷,每个人都在追逐 The Next Thing。在这个被摩尔定律决定的行业,平均每 18 个月就能让计算能力翻倍,让技术井喷。但是过快的发展速度一定程度上也给新的技术带了不稳定性,就像 Gerald Weinberg 说的那样:

    76020发布于 2019-09-16
  • 来自专栏企鹅号快讯

    zOS Connect 助力你的业务更上一层楼

    https://developer.ibm.com/mainframe/products/zosconnect/ https://developer.ibm.com/mainframe/category/zos-connect

    1.1K00发布于 2017-12-26
  • 来自专栏OSChina

    打包生成 zip 文件

    FileInputStream fis = null; BufferedInputStream bis = null; FileOutputStream fos = null; ZipOutputStream zos " + sourceFilePath + "里面不存在文件,无需压缩."); }else{ fos = new FileOutputStream(zipFile); zos //创建ZIP实体,并添加进压缩包 ZipEntry zipEntry = new ZipEntry(sourceFiles[i].getName()); zos.putNextEntry = -1){ zos.write(bufs,0,read); } } flag = true; } } } catch (FileNotFoundException = zos) zos.close(); if(null != fis) fis.close(); if(null !

    2.2K40发布于 2019-08-01
  • 来自专栏闻道于事

    Java常用工具类之压缩解压

    = null; try { fos = new FileOutputStream(target); zos = new BufferedOutputStream(fos)); // 添加对应的文件Entry addEntry("/", source, zos @param base * 基路径 * * @param source * 源文件 * @param zos throws IOException */ private static void addEntry(String base, File source, ZipOutputStream zos = -1) { zos.write(buffer, 0, read); } zos.closeEntry

    1.4K50发布于 2018-02-28
  • 来自专栏Java开发

    java中将一个文件夹下所有的文件压缩成一个文件

    files * 多个文件 * @param baseFolder * 压缩到ZIP的父级目录(目录后面跟上File.separator) * @param zos * @throws Exception */ private static void zip(File[] files, String baseFolder, ZipOutputStream zos )) { // 递归 zip(file.listFiles(), baseFolder + file.getName() + File.separator, zos } entry = new ZipEntry(baseFolder + file.getName()); // 加入 zos.putNextEntry = -1) { // 写入 zos.write(buffer, 0, count); } zos.closeEntry()

    2.3K30发布于 2018-09-06
  • 来自专栏c++与qt学习

    项目知识盲区五

    = null ; try { zos = new ZipOutputStream(out); File sourceFile = new = null){ try { zos.close(); } catch (IOException ) { byte[] buf = new byte[BUFFER_SIZE]; zos.putNextEntry(new ZipEntry = -1){ zos.write(buf, 0, len); } zos.closeEntry() = null){ try { zos.close(); } catch (IOException

    59230编辑于 2021-12-27
  • 来自专栏CSDNToQQCode

    【Auto.js】[zip压缩] 将文件夹压缩成zip包

    ); compress(sourceFile, zos, sourceFile.getName()); var end = System.currentTimeMillis +" ms"); } catch (e) { throw ("zip error from ZipUtils"+e); } finally { if(zos = null){ try { zos.close(); } catch (e) { log (sourceFile)){ zos.putNextEntry(new ZipEntry(name)); var len; var = -1){ zos.write(len); } zos.closeEntry(); put.close

    2.5K20编辑于 2022-11-29
  • 来自专栏大冰块技术记录

    MD5压缩解压

    ByteArrayOutputStream bos = new ByteArrayOutputStream(); DeflaterOutputStream zos = new DeflaterOutputStream(bos); zos.write(data.getBytes()); zos.close(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); InflaterOutputStream zos = new InflaterOutputStream(bos); zos.write(decodeBASE64(encodeData)); zos.close

    32110编辑于 2023-11-26
  • 来自专栏BennuCTech

    【Android开发】如何打包压缩文件、文件夹?

    (buffer, 0, len) len = fis.read(buffer) } 不要忘了关闭条目和流: zos.flush() zos.closeEntry() fis.close() zos.close (buffer, 0, len) len = fis.read(buffer) } zos.flush() zos.closeEntry() fis.close () } zos.close() 对于每个文件都需要添加一个条目,然后写入内容,最后别忘了关闭条目。 (buffer, 0, len) len = fis.read(buffer) } zos.flush() zos.closeEntry ", src, zos) zos.close() 这样就可以将一个文件夹下的所有文件打包进压缩包里了。

    1.5K20编辑于 2023-08-28
  • 来自专栏Java架构师必看

    java压缩文件乱码问题

    2、压缩文件注释的中文乱码问题:zos.setComment("中文测试");通过使用设置编码的方法(zos.setEncoding("gbk");)发现问题,测试项目的编码方式为gbk,而默认编码是utf String[] args) throws Exception { File f = new File("中文测试.txt"); ZipOutputStream zos (new BufferedOutputStream( new FileOutputStream("zipTest.zip"), 1024)); zos.putNextEntry = -1) { zos.write(c); } zos.setEncoding("gbk"); zos.setComment ("中文测试"); zos.closeEntry(); zos.close(); } } 谢谢大家,希望帮助更多的人

    1.3K20编辑于 2022-01-17
  • 来自专栏小工匠聊架构

    Java-工具类之ZIP压缩解压

    = new ZipOutputStream(fos); zos.putNextEntry(new ZipEntry(file.getName())); byte[] bytes = Files.readAllBytes(Paths.get(filePath)); zos.write(bytes, 0, bytes.length) ; zos.closeEntry(); zos.close(); } catch (FileNotFoundException ex) FileOutputStream fos = new FileOutputStream(zipFileName); ZipOutputStream zos (bytes, 0, bytes.length); zos.closeEntry(); } zos.close();

    2.3K20发布于 2021-08-17
  • 来自专栏Java升级打怪进阶之路

    Java把文件压缩成.zip压缩包和解压.zip压缩包(ZipOutputStream、ZipInputStream)

    = null; try { zos = new ZipOutputStream(out); File sourceFile = new File(srcDir { throw new RuntimeException("zip error from ZipUtils", e); } finally { if (zos 会压缩失败) * @throws Exception */ private static void compress(File sourceFile, ZipOutputStream zos = -1) { zos.write(buf, 0, len); } // Complete the entry zos.closeEntry // 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了 compress(file, zos

    1.8K20编辑于 2022-11-28
  • 来自专栏程思阳的专栏

    Android笔记:底部导航栏的动态替换方案

    { if (zos ! = null) { zos.finish(); CloseUtils.closeIO(zos); } return zipFile(resFile, "", zos, comment); } finally { if (zos ! = null) { CloseUtils.closeIO(zos); } } } /** * 压缩文件 = -1) { zos.write(buffer, 0, len); } zos.closeEntry

    2.6K20编辑于 2022-01-10
  • 来自专栏项勇

    笔记101 | 文件的压缩与解压笔记

    home/liangruihua/ziptest/1.zip -- the out put file path and // name ZipOutputStream zos home/liangruihua/ziptest/1.zip" ) ) ; BufferedOutputStream bos = new BufferedOutputStream ( zos ) ; // set the file name in the .zip file zos.putNextEntry ( new ZipEntry ( "1.txt" ) ) ; // set the declear zos.setComment ( "by liangruihua test!" compress File file = new File ( "/home/liangruihua/ziptest/test" ) ; ZipOutputStream zos

    54020发布于 2020-07-24
  • 来自专栏java开发的那点事

    Java 将文件夹打成压缩包 zip

    BufferedInputStream bis = null; FileOutputStream fos = null; ZipOutputStream zos } else { fos = new FileOutputStream(zipFile); zos ZipEntry zipEntry = new ZipEntry(sourceFiles[i].getName()); zos.putNextEntry = -1) { zos.write(bufs, 0, read); } = zos) { zos.close(); } } catch (IOException

    5.2K21发布于 2020-12-02
  • 来自专栏卯金刀GG

    【java基础】zip压缩文件

    FileInputStream fis = null; BufferedInputStream bis = null; FileOutputStream fos = null; ZipOutputStream zos + sourceFilePath + "里面不存在文件,无需压缩."); } else { fos = new FileOutputStream(zipFile); zos // 创建ZIP实体,并添加进压缩包 ZipEntry zipEntry = new ZipEntry(sourceFiles[i].getName()); zos.putNextEntry = -1) { zos.write(bufs, 0, read); } } flag = true; } } } catch = zos) zos.close(); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException

    2.1K10发布于 2019-07-25
  • 来自专栏用户5305560的专栏

    (强烈推荐)基于SSM和BootStrap的共享云盘系统设计(项目实现:文件下载)

    "" : "等" + sourcePath.length + "个文件") + ".zip"; ZipOutputStream zos = null; try { zos ); } } finally { if (zos ! = null) { zos.close(); } } return zipName; } 2)FileService中定义writeZos */ private void writeZos(File file, String basePath, ZipOutputStream zos) throws IOException { = -1) { zos.write(data, 0, count); } bis.close(); } } 3)当成功下载

    82810发布于 2021-08-11
  • Java 文件操作全指南:读写、复制、压缩与实战应用

    ZipExample { public static void main(String[] args) throws IOException { try (ZipOutputStream zos FileOutputStream("archive.zip"))) { ZipEntry entry = new ZipEntry("hello.txt"); zos.putNextEntry (entry); byte[] data = "这是文件内容".getBytes(); zos.write(data); zos.closeEntry String archiveName = "log_" + System.currentTimeMillis() + ".zip"; try (ZipOutputStream zos (entry); Files.copy(Paths.get(logFile), zos); zos.closeEntry(); }

    51200编辑于 2025-06-10
  • 来自专栏大数据那些事

    前后端分离项目后端向前端返回压缩包的方法实现java版

    = null; OutputStream os = response.getOutputStream(); try { zos = new ZipOutputStream = null) { zos.putNextEntry(new ZipEntry(imagePath)); int len; ();//不让一个循环后ftpClient自动关闭 } } zos.flush(); } catch (Exception e) { e.printStackTrace(); } finally { if (zos ! = null) { try { zos.close(); } catch (IOException

    1.3K10发布于 2021-09-28
  • 来自专栏韩曙亮的移动开发专栏

    【Android 安全】DEX 加密 ( Java 工具开发 | 解压 apk 文件 | 加密生成 dex 文件 | 打包未签名 apk 文件 | 文件解压缩相关代码 )

    = ZipOutputStream(cos) // 压缩文件 compress(dir, zos, "") zos.flush() zos.close() } private fun compress(srcFile: File, zos: ZipOutputStream, basePath: String) { if (srcFile.isDirectory) { , basePath + srcFile.name + "/") } } else { compressFile(srcFile, zos, basePath) } } private fun compressFile(file: File, zos: ZipOutputStream, dir: String) { // 拼接完整的文件路径名称 = -1) { zos.write(data, 0, len) } fis.close() zos.closeEntry() } 六、执行结果 ---- 下图中

    2.1K00编辑于 2023-03-28
领券