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
0
votes
1 answer

Why does ZipInputStream.getNextEntry() return null?

I have a zip file that is AES encrypted. After decrypting I'm left with a byte[] containing the zip content. But when I try to unzip it, using a ByteArrayInputStream, ZipInputStream.getNextEntry() returns null right away. Debugging, I see that my…
wolfman
  • 123
  • 9
0
votes
1 answer

Getting XML data from the byteArray of a zipFile

I'm writing a simple program that retrieves XML data from an object, and parses it dynamically, based on user criteria. I am having trouble getting the XML data from the object, due to the format it is available in. The object containing the XML…
Klua
  • 11
  • 3
0
votes
0 answers

How to write a Junit for ZipInputStream.getNextEntry

I have the following junit test code method inside a junit class @Test public void validateExcelTestWithImagesFolder() throws IOException { final MediaModel excelmediaModel = Mockito.mock(MediaModel.class); final Workbook workbook =…
Karthik
  • 371
  • 3
  • 7
  • 30
0
votes
1 answer

Android 10 (Android Q): How to unzip file due to External Storage Changes (without android:requestLegacyExternalStorage)

Can the Android 10(Android Q) download the zip file and extract the zip file? I really have no idea. How do I unzip the file without using Environment.getExternalStorageDirectory() without adding this android:requestLegacyExternalStorage="true" in…
0
votes
1 answer

Reading remote zip file using apache.commons.compress.archivers.zip

I am trying to read a remote zip file (created with IONIC vendor) but I need to use apache.commons.compress.archivers.zip in order to achieve it with java only. I already tried using java.util.zip ZipInputStream but without success (for regular zip…
Eyal Sooliman
  • 1,876
  • 23
  • 29
0
votes
1 answer

How to detect file type from its content in zip archive?

I have a zip archive that contains several gzip files. But gzip file's extentions are also .zip . I walk through zip archive with ZipInputStream. How can I detect inner file's type with reading its content rather than extentions. I also need not to…
Gürcan Kavakçı
  • 562
  • 1
  • 11
  • 24
0
votes
0 answers

How to list all the children directories name present inside a specific directory which is present inside zip file in java

Let suppose, I have a zip file 'zipTest', it contains two directories say 'Final' and 'Test' (zip file may contain more directoris as well, for simplicity I mentioned only two). I want to list all the direct children directories name present inside…
0
votes
1 answer

Java : Unexpected end of ZLIB input stream while attempting to merge split zip files

I have split zip files that I'm trying to merge using Java. But I get Unexpected end of ZLIB input stream error. Any thoughts on what I'm doing wrong? File bigZip = new File("bigZip.zip"); List zipList =…
0
votes
1 answer

ZipInputStream Stream Closed error on nextEtnry/closeEntry

I'm trying to upload 1 zip file and extracting it in a AWS S3 bucket. I get Stream Closed error: java.io.IOException: Stream closed at java.base/java.util.zip.ZipInputStream.ensureOpen(Unknown Source) at…
Harry
  • 546
  • 6
  • 22
  • 50
0
votes
2 answers

unzip archive with subfolders in java?

I am trying to unzip an archive (test.zip) containing a subfolder with some png images: test.zip | -> images | -> a.png | -> b.png Here is what I do: public static void unzip(String archive, File baseFolder, String[]…
u123
  • 15,603
  • 58
  • 186
  • 303
0
votes
2 answers

Read multiple files zip file with multiple sub directories

I have a zip file with the structure like: xml.zip Root Folder: package Folder: Subfolder.zip Inside Subfolder.zip : Root Folder: _ Folder: var Folder: run Folder: xmls Xml1.xml Xml2.xml Xml3.xml Is there a way to read in…
0
votes
1 answer

Glide 4.X: DataFetcher - attempt to load a picture from ZIP file

I have to decrypt image and load it to ImageView by means of Glide with a constraint to do not save decrypted images on the disk. As I know Glide has an opportunity to do that with DataFetcher. As an example of a DataFetcher usage I would like do…
isabsent
  • 3,683
  • 3
  • 25
  • 46
0
votes
1 answer

Unzipping into a ByteArrayOutputStream -- why am I getting an EOFException?

I have been trying to create a Java program that will read zip files from an online API, unzip them into memory (not into the file system), and load them into a database. Since the unzipped files need to be loaded into the database in a specific…
fairground
  • 61
  • 1
  • 7
0
votes
1 answer

How to read and extract zip entries from java.sql.Blob type zip file without having FileInputStream or filepath as a string java

public static void unzipFiles(java.sql.Blob zip) throws Exception{ String paths = ""; byte[] blobAsBytes = zip.getBytes(1, (int) zip.length()); ZipInputStream zis = new ZipInputStream(zip.getBinaryStream(), StandardCharsets.UTF_8); ZipEntry…
A.Rangoda
  • 13
  • 3
0
votes
0 answers

How to unzip ServletInputStream using zip4j library

I am uploading a zip file (heap dump) in a request through postman tool and retrieving file content in servlet using request.getInputStream() method. Postman Image I have an InputStream that contains zipped bits and would like to decompress that…
Mahesh
  • 103
  • 1
  • 10