The Apache Commons compress library seems focused around writing a TarArchiveEntry to TarArchiveOutputStream. But it looks like the only way to create a TarArchiveEntry is with a File object.
I don't have files to write to the Tar, I have byte[]s in memory or preferably streams. And I don't want to write a bunch of temp files to disk just so that I can build a tar.
Is there any way I can do something like:
TarEntry entry = new TarEntry(int size, String filename);
entry.write(byte[] fileContents);
TarArchiveOutputStream tarOut = new TarArchiveOutputStream();
tarOut.write(entry);
tarOut.flush();
tarOut.close();
Or, even better....
InputStream nioTarContentsInputStream = .....
TarEntry entry = new TarEntry(int size, String filename);
entry.write(nioTarContentsInputStream);
TarArchiveOutputStream tarOut = new TarArchiveOutputStream();
tarOut.write(entry);
tarOut.flush();
tarOut.close();