I am sending .tar.gz MultipartFile in my api request, and I want to untar and store all the files in List<File>
or List<FileItem>
So Far I have...
public void importFilesTar(MultipartFile file) throws ContentRepositoryDaoException, Exception {
List<File> files = new ArrayList<File>();
List<FileItem> fileItems = new ArrayLis<FileItem>();
InputStream in = file.getInputStream();
GzipCompressorInputStream gzipIn = new GzipCompressorInputStream(in);
TarArchiveInputStream tarIn = new TarArchiveInputStream(gzipIn);
TarArchiveEntry entry;
while ((entry = (TarArchiveEntry) tarIn.getNextEntry()) != null) {
// Get each file from the .tar.gz, and add it to files (List<File>) or fileItems (List<FileItem>)
}
}
But I am unable to successfully untar, get the files and add it to list of File or FileItems. Thanks