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
6
votes
3 answers

Getting the size of ZipInputStream

Is there anyway to find/estimate the size of ZipInputStream before we completely read the stream? For instance, we can get the entry's metadata with getNextEntry before we can read the userdata. Inputstream has a method available() to return an…
Pradeep Vairamani
  • 4,004
  • 3
  • 36
  • 59
5
votes
1 answer

Returning ZipInputStream as a Jax-RS Response object

I am trying to return a ZipInputStream containing two different outputstreams as a javax.ws.rs.core.Response Stream. When I make a web service call to retrieve the stream, I notice that I get an empty stream back. I have tried returning a…
theseeker
  • 168
  • 1
  • 5
5
votes
2 answers

Android: Faster way to read/write a ZipInputStream?

I am currently writing an application that reads a zip file in my assets folder which contains a bunch of images. I am using the ZipInputStream API to read the contents and then writing each file to my: Environment.getExternalStorageDirectory()…
Jack
  • 261
  • 2
  • 5
5
votes
1 answer

java decompress zipfile with unicode filenames

How to decompress a zip file with unicode filename? This is my code: try { ZipInputStream zis = new ZipInputStream( new FileInputStream(zipFile)); ZipEntry ze = zis.getNextEntry(); System.setProperty("file.encoding",…
shuttle1978
  • 123
  • 2
  • 12
5
votes
3 answers

extracting contents of ZipFile entries when read from byte[] (Java)

I have a zip file whose contents are presented as byte[] but the original file object is not accessible. I want to read the contents of each of the entries. I am able to create a ZipInputStream from a ByteArrayInputStream of the bytes and can read…
peter.murray.rust
  • 37,407
  • 44
  • 153
  • 217
5
votes
3 answers

Finding a file in zipentry java

I am trying to find a file within a zip file and get it as an InputStream. So this is what I am doing to get it so far and I am not certain if I am doing it correctly. Here is a sample as the original is slightly longer but this is the main…
Donkey King
  • 105
  • 1
  • 2
  • 8
4
votes
6 answers

How can I convert ZipInputStream to InputStream?

I have code, where ZipInputSream is converted to byte[], but I don't know how I can convert that to inputstream. private void convertStream(String encoding, ZipInputStream in) throws IOException, UnsupportedEncodingException { final int…
newbie
  • 24,286
  • 80
  • 201
  • 301
4
votes
2 answers

Is there any way to upload extracted zip file using "java.util.zip" to AWS-S3 using multipart upload (Java high level API)

Need to upload a large file to AWS S3 using multipart-upload using stream instead of using /tmp of lambda.The file is uploaded but not uploading completely. In my case the size of each file in zip cannot be predicted, may be a file goes up to 1 Gib…
Shajesh
  • 71
  • 7
4
votes
0 answers

Support for password protected zip files in hdfs?

We were using zipinputstream for reading the zip files present in hdfs.But now we had password protected zip files.Is there any way to decode the zip files in hdfs only,before passing it to zipinputstream?There is a java library zip4j,which works…
mahan07
  • 887
  • 4
  • 14
  • 32
3
votes
2 answers

java.util.zip.ZipException: invalid compression method

I am having some issues in dealing with zip files on Mac OS X 10.7.3. I am receiving a zip file from a third party, which I have to process. My code is using ZipInputStream to do this. This code has been used several times before, without any issue…
Bhushan
  • 18,329
  • 31
  • 104
  • 137
3
votes
1 answer

Java - Zip output stream dynamic buffer size

I'm working on application that takes files from one zip and put them in the other, its fine with files but if there is a dir in the source zip it fail with the following exception: Exception in thread "main" java.util.zip.ZipException: invalid…
Liam Haworth
  • 848
  • 1
  • 9
  • 27
3
votes
3 answers

How to read data from nested zip files in Java without using temporary files?

I am trying to to extract files out of a nested zip archive and process them in memory. What this question is not about: How to read a zip file in Java: NO, the question is how to read a zip file within a zip file within a zip and so on and so…
R TheWriter
  • 163
  • 2
  • 8
3
votes
0 answers

Zip folder is corrupted after editing content

I am trying to copy a zipped bytes array to another one using ZipOutputStream/ZipIntputStream, but it seems that the result array is not equal the original one, why is that wrong? public static void main(String[] args) throws IOException { File…
3
votes
1 answer

How to convert a byte array to ZIP file and download it using Java?

I need to write a code to convert a byte array to ZIP file and make it download in Spring MVC. Byte array is coming from a webservice which is a ZIP file originally. ZIP file has a folder and the folder contains 2 files. I have written the below…
3
votes
1 answer

Getting document.xml from a docx file using ZipInputStream

I have a inputStream of a docx file and I need to get hold of the document.xml which lies inside the docx. I am using ZipInputStream to read my stream and my code is something like ZipInputStream docXFile = new ZipInputStream(fileName); …
user314523
  • 31
  • 1
  • 3
1
2
3
10 11