Write a tar file of unknown (large) size in Java

I want to write a large stream of unknown size with a tar file in Java I know Apache has handles tar files, but they asked me to know the size in advance Consider Apache's own example:

TarArchiveEntry entry = new TarArchiveEntry(name);
entry.setSize(size);
Taroutput.putArchiveEntry(entry);
Taroutput.write(contentOfEntry);
Taroutput.closeArchiveEntry();

After writing, I will know the size of this item, but I haven't done it before Is there a way that I can write the content when I finish the size and then write the title?

Solution

I ended jtar and modified it, so you don't have to specify the size until you write There seems to be no package to do this. Originally... I set up a @ L_ 301_ 5 @ request this change Unfortunately, it requires a lot of ugly code and creates my own randomaccessfileinputstream (), which is not suitable for uploading patches

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>