使用Java压缩文件:是否有限制? [英] Zip files with Java: Is there a limit?

查看:229
本文介绍了使用Java压缩文件:是否有限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java为我的应用程序创建备份例程。
但是,当zip文件超过4GB,或者文件超过65,000(大约)时,zip文件已损坏。

I'm creating a backup routine for my application with Java. However, when the zip file is over 4GB, or has more than 65,000 files (approximately), the zip file is corrupted.

我也在测试用于压缩到tar.gz的Apache Commons Compression,但它的文件名限制为100个字符。
我想测试这个压缩到压缩的API,但我想知道java zip的问题究竟是什么。

I'm also testing the Apache Commons Compression for compacting to tar.gz, but it has file name limit of 100 characters. I was wanting to test this API compressing to zip, but I wonder what exactly is the problem with the java zip.

所以,真正的问题是:我做错了什么,它是Java Zip实现的限制,还是Zip格式本身的限制?

So, the real question is: I'm doing something wrong, it is limit of Java Zip implementation, or is the limit for the Zip format itself?

谢谢。

推荐答案

维基百科引用:


原始ZIP格式对
的各种内容有4 GiB限制(文件的未压缩大小,文件的压缩大小和存档的总大小
),以及ZIP存档中65535个条目的限制。

The original ZIP format had a 4 GiB limit on various things (uncompressed size of a file, compressed size of a file and total size of the archive), as well as a limit of 65535 entries in a ZIP archive.

和ZIP64 :


Java的内置java.util.zip从9月
2010开始不支持它,但它已被添加到OpenJDK并计划包含在
Java 7中。

Java's built-in java.util.zip does not support it as of September 2010, but it has been added to OpenJDK and is planned for inclusion in Java 7.

这篇关于使用Java压缩文件:是否有限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆