How do I append files to a .tar archive in Java?

前端 未结 2 845
野的像风
野的像风 2021-01-23 10:11

I would like to create a tar archive in Java. I have files which are constantly being created and I\'d like a worker thread to take a reference to those files from a queue and c

相关标签:
2条回答
  • 2021-01-23 10:47

    I use a library called Java Tar: http://www.trustice.com/java/tar/

    It's worked for me. In that package, look for:

    http://www.gjt.org/javadoc/com/ice/tar/TarArchive.html#writeEntry(com.ice.tar.TarEntry, boolean)

    Which lets you add an entry to the file without using a stream at the user level. I don't know about file size - but it would be a simple matter to test this aspect.

    0 讨论(0)
  • 2021-01-23 10:49

    You run here in a limitation of tar: http://en.wikipedia.org/wiki/Tar_(file_format)#Random_access

    because of that it is hard to add or remove single files without copying the whole archive.

    0 讨论(0)
提交回复
热议问题