jtar
jtar copied to clipboard
High-level API
I created a wrapper API so you can do the 80% cases in one line:
new JTar().unpackTar("path/to/my.tar", "/tmp/tartest/")
new JTar().unpackTarGz(new File(sourceDir, "my.tar.gz), targetDir)
Would you consider merging a pull request?
Currently, it does what I want: Unpack everything from a compressed or uncompressed tar into a directory. I'd extend the API for packing in case you want to include it. Suggestions welcome.
The code: https://github.com/mknecht/jtar/blob/master/src/main/java/org/kamranzafar/jtar/JTar.java The tests: https://github.com/mknecht/jtar/blob/master/src/test/java/org/kamranzafar/jtar/JTarTest.java
I'm not sure but this might also require for JTar
class to be implemented as singleton since this might lead to a bunch of instances of JTar which can also cause memory leaks.
A careful approach is needed indeed. My suggestions is to implement this approach in another package and protect the original JTar
class since it is definitely needed for low-level stuff.