我正在尝试使用JAXB将一个6 6GB左右的以制表符分隔的大型.txt文件转换为.xml文件。这部分工作得很好,但是当我尝试使用ZipOutputStream将该.xml放入.zip中时,当我尝试之后查看它时,.xml变得损坏(但它适用于较小的文件)。
有没有其他方法可以做到这一点,或者在进程运行后手动进行压缩会更好?下面是我在尝试制作.zip文件时使用的一些代码。
IFSFile source = null;
IFSFileOutputStream target = null;
ZipOutputStream targetZip = null;
String targetName = "C:/test.zip";
source = new IFSFile(as400, sourceName);
BufferedReader readBuffer = new BufferedReader(new IFSFileReader(source));
target = new IFSFileOutputStream(as400, targetName, IFSFileOutputStream.SHARE_NONE, false);
targetZip = new ZipOutputStream(target);
ZipEntry ze = new ZipEntry("test.xml");
targetZip.putNextEntry(ze);
//JAXB stuff omitted, seems to be working as no problems with smaller files
while ((strRead = readBuffer.readLine()) != null) {
currentRecord = new stuff;
marshaller.marshal(currentRecord, targetZip);
}
targetZip.closeEntry();
targetZip.close();
readBuffer.close();在寻找大小限制时,我所能找到的就是,如果.zp最终超过4 4GB,它将被损坏,而我认为它不会。我是不是做错了什么,或者我应该使用ZipOutputStream以外的其他东西来解决这个问题?
发布于 2013-04-26 05:14:32
取而代之的是GZIPOutputStream,它是java.util的一部分(所以是标准的),在所有情况下都有更好的压缩率,并且肯定可以处理大于4 4Gb的文件。
我认为ZipOutputStream可能不是ZIP64的实现,如果是这样的话,原始的ZIP格式有4 4Gb的限制,因为这是32位文件系统上的最大限制。
发布于 2013-04-26 05:13:42
我想4 4gb是java设置的上限,你有没有尝试过java 7?我读到这可能是java also.Please中的错误,也检查了truezip
https://stackoverflow.com/questions/16224724
复制相似问题