Questions tagged [zipinputstream]

A mechanism for reading zip-compressed data from a stream

A ZipInputStream is a mechanism for reading data from a stream, where the data is in a zip-compressed format. A stream is usually comprised of data being read from a local file, or data being transmitted from a remote server over a network protocol such as HTTP or FTP. As the data is read from the stream, the ZipInputStream decompresses it, and returns the uncompressed data to the application.

164 questions
1
vote
3 answers

How to extract zip archive with subdirectories using SAF / DocumentFile?

I'm struggling with extracting a zip file contents using the evil Storage Access Framework, as you may know; I can't use any File objects so I have to use ZipInputStream, ZipOutputStream and DocumentFile, Here's the zip file structure: Folder 1/ABC…
Al_HK
  • 65
  • 1
  • 9
1
vote
1 answer

How to read a zip entry into a postgres table using the JDBC copymanager

I am using the JDBC CopyManager library's copyout method to backup a postgres table to an AWS S3 bucket as a csv file. This works. I am saving this backup as a zip containing the file in order to save space in the AWS bucket. I am now working on…
GNG
  • 1,341
  • 2
  • 23
  • 50
1
vote
1 answer

java renaming contents of zip/gz file without inflating

For .zip file we have, in Java, ZipInputStream and ZipOutputStream for reading from and writing to zip file. zin = new ZipInputStream(new FileInputStream("xx.zip")); ZipEntry entry = zin.getNextEntry(); while (entry != null) { …
Dr. Debasish Jana
  • 6,980
  • 4
  • 30
  • 69
1
vote
0 answers

zip file corrupted or has NUL bytes at the beginning correct it and re create the zip in Java

we are receiving a zip file through http post url,some times this zip file is corrupted or while zipping from source contains NUL bytes while it is adding the files to the zip when ever it takes more time to create the files to zip. Now we have…
1
vote
1 answer

How to generate the ZipFile in java

I am new to using the streams.I am trying to download zipfile using httpClient in my appliation.when I am downloading the zip file I am getting the sucessfull response from the client.with the response I am trying to generate the zipfile in my local…
1
vote
0 answers

Unable to extract the zip64 archive using ZipInputStream with Java7 and Java8

I am using the below code to extract the files from zip archive. public static List unzipFiles(File zipFile, File targetDirectory) { List files = new ArrayList(); BufferedOutputStream dest = null; FileInputStream…
1
vote
0 answers

Directly read a specific subdirectory from a zip file [Java]

I would like to directly read the files from a subdirectory which is in a zip file. Is there a more convenient way to do it without iterating through all entries? The structure of the zip file is always the same, only the files in the subdirectory…
nikolakoco
  • 1,343
  • 1
  • 12
  • 22
1
vote
1 answer

.war file created using ZipOutputStream fails to deploy

I am reading a .war file and after reading it into a ZipInputStream , i edit the web.xml and add weblogic.xml - and then transfer all this into ZipOutputStream , which i write as the final output.war file. The problem that i am facing is , the…
Tom
  • 135
  • 1
  • 5
  • 14
1
vote
0 answers

How to handle the zipfiles present in s3 that are actually returning size as -1 using ZipEntry?

In my case, the zipfile is in S3 Bucket and we are trying to get the uncompressed size of it using ZipInputStream and its size as entry.getSize() which is actually returning -1. I googled and found to use ZipFile,Enumeration and zipfile.entries()…
praveen
  • 63
  • 2
  • 4
  • 9
1
vote
1 answer

Why zipInputStream is empty though entry exists?

I am trying to unzip archive, zis.getNextEntry() gives me nextEntry, I can see the correct name of the entry, but zip input stream itself is empty. Why? byte[] htmlFile = new byte[]{}; ByteArrayInputStream bais = new…
user453575457
  • 464
  • 6
  • 21
1
vote
3 answers

Java InputStream read buffer

Say I'm trying to read from a Java InputStream like this: ZipInputStream zis = new ZipInputStream(new FileInputStream("C:\\temp\\sample3.zip")); zis.getNextEntry(); byte[] buffer2 = new byte[2]; int count = zis.read(buffer2)); if(count != -1)…
PentiumPro200
  • 641
  • 7
  • 23
1
vote
2 answers

Java ZipInputStream extraction errors

Below is some code which extracts a file from a zip file containing only a single file. However, the extracted file does not match the same file extracted via WinZip or other zip utility. I expect that it might be off by a byte if the file…
PentiumPro200
  • 641
  • 7
  • 23
1
vote
1 answer

how to read ZipInputStream into CharArrayReader

Right now i am developing an application using Google App Engine (GAE). GAE doesnt allow me to create temp folder for me to store my zipfile and read from it. The only way is to read it from memory. The zipfile contains 6 CSV files which i need to…
Wen Jun
  • 522
  • 3
  • 9
  • 19
1
vote
1 answer

Android ZipInputStream ZipEntry does not read to end of file

I have a zipped flie containing a json file and some base64 decoded images, I use the following code to read the data from it: JSONArray model = new JSONArray(); ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputStream)); …
Mohamed
  • 337
  • 3
  • 18
1
vote
0 answers

Java ZipFile api fails to extract large files

I am reading a large zip file (above 2.5GB). When i try to decompress a file above 2.5GB, I get an exeption java.util.zip.ZipException: error in opening zip file java.util.zip.ZipException: error in opening zip file at…