How to read file from ZIP archive
I am facing a problem where i need to convery the zipentry into a file.
What happens is that I have a zip file full of csv files. I need to unzip the file and extract out the csv files 开发者_StackOverflow社区and read it using a Scanner() which takes in only a file (type) and not a zipentry...
Scanner
class also accepts InputStream
in one of its constructors. Once you have ZipEntry
(you obtain it from ZipFile
), you can use it in myZipFile.getInputStream(zipEntry)
method to get InputStream
that you can pass to Scanner
.
精彩评论