thrau / jarchivelib

A simple archiving and compression library for Java
https://github.com/thrau/jarchivelib
Apache License 2.0
198 stars 36 forks source link

Get extracted size? #25

Closed mario closed 10 years ago

mario commented 10 years ago

Hi,

is it possible to get size of the extracted tarball (tgz) would have on the filesystem through one of the lib methods?

Cheers.

thrau commented 10 years ago

ArchiveEntry can access the size of a file in the archive, so you could try to call Archiver#stream(File) on your archive, iterate over all archive entries and collect their sizes. I can't tell you whether that will give you the 100% correct final size on the file system, but at the very least it'll be a good estimate.

mario commented 10 years ago

Thanks for the fast reply - I was aware of that, was hoping there's some convenience method ;)