-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Archiver.stream(ArchiveStream) support #51
Comments
i've never thought much about nesting archive streams, it's certainly not possible in any way with the current API. but it sounds like a fun thing to implement. on first glance i think this will involve some wrapping mechanism of the |
actually, this should work Archiver arArchiver = ArchiverFactory.createArchiver("ar");
Archiver tarGzArchiver = ArchiverFactory.createArchiver("tar", "gz");
ArchiveStream stream = arArchiver.stream(new File("/home/thomas/bar.ar"));
ArchiveEntry entry;
while ((entry = stream.getNextEntry()) != null) {
if (entry.getName().endsWith(".tar.gz")) {
tarGzArchiver.extract(stream, new File("/tmp/")); // will extract the contents of the nested archive
// will close the stream! see #52
}
}
stream.close(); the problem in the current version is that i'll fix #52 and deploy a snapshot |
you can use |
Wow, thanks for the speedy response. I've been thinking about this over the weekend realised now that my request was very poorly worded. My current code looks like this:
Ultimately, it would be really nice to stream from the entry. Something like this:
In the mean time, I'll test out your changes. |
the point of jarchivelib is to make it convenient to handle archives as |
Thanks Thomas for taking the time to respond. I will look into that. It's just that your API is much nicer to deal with ;-) Sorry to have wasted your time. I do appreciate your help thus far. |
The thing that is completely missing in |
thanks for the input! |
Debian archive files (.deb) are an "ar" file containing a set of tar.gz files.
I'd love to be able to pass the ArchiveStream from the "ar" into a new Archiver.stream() call to extract a file from the embedded tar.gz.
I'm not familiar enough with Streams to know if that would work. Archiver.stream() appears to take a File only.
Thoughts?
The text was updated successfully, but these errors were encountered: