173 questions
0
votes
1
answer
62
views
Why is my created zip file (using ZipOutputStream) invalid?
I've been trying to retrieve all the files in the current directory, create a zip file, and place all the files into that zip file. Currently, I'm able to retrieve all the files, but I'm not sure they'...
0
votes
1
answer
50
views
Zip contents corrupted when trying to zip via ZipOutputStream in RxJava
I am trying to create a zip file and upload that zip file in AWS S3 via a multipart upload route. However, I am facing an issue where the file is successfully getting generated however, the contents ...
0
votes
1
answer
92
views
Create a zip consisting of multiple fileoutputStreams objects
I have a method in which in a loop I am creating FileOutputStream objects of excel files. Each file is in different folder as per the requirement. I need to create a zip response as well of the whole. ...
0
votes
0
answers
98
views
Corrupt Zip file using ZipOutputStream to create DOCX file
I use ZipOutputStream to compress the content of a folder into a Zip file. Below is my working code. But it creates corrupt DOCX files. Trying to extract them on macOS fails.
private const val ...
1
vote
0
answers
420
views
StreamingResponseBody with ZipOutputStream to WebFlux and reactive programming
In my application (Spring MVC) I have a legacy endpoint returning a ResponseEntity<StreamingResponseBody>. The StreamingResponseBody is basically a ZipOutputStream built by fetching a list of ...
1
vote
2
answers
527
views
Java download zip file with HTTPResponse works at localhost but failed at server
I've created a download button to get a zip file of product photos. It works fine when testing in localhost but doesnt work after deployed to server.
No zip file was created and there're no error ...
0
votes
1
answer
640
views
Generated zip file is always corrupted after download on Mac
Lets say that I have a collection of objects which I would like to wrap with zip. My zip conversion class looks like:
public class ZipFile {
public byte[] createZipByteArray(String fileName, byte[...
0
votes
1
answer
1k
views
How to create a zip file from binary data without knowing contents of zip file in java?
I am listening to binary data from queues which is actually a zip file data. I want to reconstruct the zip file using java code but I do not have any information about contents of zip file such as no ...
1
vote
1
answer
620
views
Save HTTP Entity ZIP response in Java
I am testing a framework in which I download zip file trough HTTP Get. I use Apache HttpClient for that. I am having hard time saving a response that is a zip file. I tried just Output Stream pointing ...
-1
votes
1
answer
228
views
How do i add files into a zip for download?
My files does not have a path because it is stored in the database. I retrieve it from blob to bytes. Whenever i download the .zip file, the file is invalid and empty even though the size of the .zip ...
0
votes
1
answer
213
views
write large HSSFWorkbook into OutputStream with ZipOutputStream
Really appreciate the assistance since I am stuck here
I am Trying to download .xls file/files in zip format
Works fine when there are small amount of data like 150 records in xls file
But once the ...
0
votes
0
answers
187
views
what are special characters not allowed to set in net.lingala.zip4j.model.ZipParameters.setFileNameInZip?
I am creating encrypted zip using zip4j_1.3.2.jar. below is my rough code. zipParameters.setFileNameInZip(fileName);
in this line if fileName is containing slash special character or filename equals ...
0
votes
2
answers
2k
views
The archive is corrupt / warning 'headers error' ... but everything works? (zip64)
I am zipping (using zip64) a number of files and then returning it in a response to the user.
response.setContentType("application/zip"); // Doesn't seem like this makes any ...
1
vote
2
answers
1k
views
Creating a zip response without actually creating all the files in the machine
The main endpoint in my program manipulates lot's of data and eventually creates Zip file, which contains parent directory with a few sub directories and a few files(splitted between the sub ...
0
votes
0
answers
774
views
Make zip from directory and download it In Spring without creating new files or directories
I have a sample directory called 'sample-directory'(in resources) with files and directories in it.
this is my endpoint:
public void downloadZipFile(@RequestBody final Parameters parameter, final ...
0
votes
1
answer
542
views
ZipOutputStream does not create new entries for Directories
I am trying to create directories in a .zip file but only one directory is being created in the .zip. I'm not sure why only the first directory gets created. zip() method gets called everytime theres ...
2
votes
3
answers
2k
views
Java - ZipOutputStream within try-with-resources
I have this Java code that creates and saves a zip file with a text file inside it:
public static void main(String[] args) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
...
0
votes
1
answer
421
views
Memory allocation error when trying to create a large zip file in memory
The memory allocation error specifically seems to occur once it hits the for loop and only for very large storesLists. I only able to hit the memory allocation error if storesList.size() is about 2 ...
0
votes
1
answer
683
views
ZipFile : Wrong values when reading
I am creating a zip file with one directory and an single compressed text file inside of it.
Code to create the zip file
try(ZipOutputStream zos=new ZipOutputStream(new FileOutputStream("E:/...
2
votes
1
answer
462
views
How to completely abort the output stream download?
we're currently working on the service that would archive the data and return it to the user as a ZipOutputStream. What we're currently looking for is an option to completely terminate the operation ...
0
votes
2
answers
454
views
VB.NEt cannot stream/download zip file to client
I have a PDF string list with strings in the form of "http://whatever.pdf" and need to create a zip file of them and stream it to client as a download.
The weird thing is if I create the zip ...
0
votes
0
answers
163
views
VB.Net: Cannot download stream file generated with ZipOutputStream
I'm trying to zip a set of pdf files and send to client as download.
No matter what combinations of Response settings I try, the code doesn't throw any exception and apparently the zip file stream is ...
0
votes
0
answers
837
views
Ktor responding outputStream causing io.netty.handler.timeout.WriteTimeoutException
I have a Ktor application that return multiple files as a stream but when the client has a slow internet connection, apparently, the stream gets full and blows launching an io.netty.handler.timeout....
-1
votes
1
answer
432
views
Assigning zip filename in Java and convert it as ByteArrayOutputStream
I am currently trying to create zipfile using ZipOutputStream and return it back as ByteArrayOutputStream.
However currently wondering how can I assign a filename for the zip itself.
Right now it will ...
0
votes
1
answer
925
views
When should I call Finish on the ZipOutputStream (SharpZipLib)
SharpZipLib is a .Net implementation for Java library for working with archives. It provides ZipOutputStream class, which derives from DeflaterOutputStream and has Finish() method. In the docs here it ...
1
vote
2
answers
9k
views
Java.util.zip.ZipException: invalid entry size (expected 18401 but got 0 bytes) when using putNextEntry() in ZipOutputStream?
I converted a zip file of 5 files into a byte array. I want to output a zip file on my disk from that bytearray. My process was first reading the byte[] into a ByteArrayInputStream then into a ...
0
votes
1
answer
369
views
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 ...
0
votes
1
answer
614
views
Generate Zip File - download PDF from Url and Generate Zip to Download in Browser - Broken PDF
I have create Rest Service and I am trying to Generate Zip file. This Zip file created from muliple PDF files which are downloaded using method InputStream inpuStream = new URL(url).openStream() . I ...
1
vote
1
answer
670
views
Prevent removing duplicates from ZipOutPutStream
I am using this functionalities to zip bunch of files, but the problem is if the there are two file names with different content but with the same original name, then only one file is been zipped, how ...
-1
votes
1
answer
648
views
Why can't I flush ZipOutputStream? [closed]
I am trying to create a zip archive in java.
Every iteration adds some data to a ZipEntry and I wanted to flush the contents after every iteration ( due to server restart handling ).
But ...
1
vote
3
answers
699
views
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 ...
0
votes
1
answer
210
views
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")...
1
vote
1
answer
1k
views
Is it possible to exclude files and/or directories when using GZIPOutputStream or ZIPOutputStream in java?
I am trying to archive all the files in the root directory of the folder but have the backups as one of the folders in the root directory so I wanted to exclude it so each backup after the first one ...
1
vote
1
answer
200
views
Add JarOutputStream to ZipOutputStream
currently I have generated a JarOutputStream and a Directory filled with *.java files.
I want to add the final JarOutputStream to a ZipOutputStream to return a final *.zip file with the directory and ...
2
votes
1
answer
2k
views
Corrupted zip file using ZipOutputStream
I'm trying to create a zip file to be able to send multiple files over http.
My issue is that the Zip file that is generated is "corrupted" before and after the file has been send. The issue ...
1
vote
1
answer
241
views
Is the compression happening after the encryption?
While reviewing an encryption scheme, I came accross the following code:
@Override
public OutputStream encrypt(OutputStream outputStream) throws Exception {
// generate the IV for ...
1
vote
1
answer
2k
views
Fortify Privacy Violation in ZipOutputStream.write() method
In Fortify code scan, we have a privacy violation in below Java code, which converts a byte[] to ZipOutputStream, which is later converted to another byte[]. The exact sink line is zos.write(arr);
...
0
votes
1
answer
970
views
Java: Problems with ZipOutputStream and UTF-8 encoding
I am currently having trouble getting a ZipOutputStream to correctly encode xml files in UTF-8 under certain circumstances.
Here's the relevant code:
public void saveQuest(File selectedFile) {
...
1
vote
1
answer
4k
views
Download Zip file from azure Storage c#
I am looping through the file names from my database and the same file i have in azure storage. I am zipping those n number of files and download from azure storage. I saves the zipped file to my ...
0
votes
1
answer
737
views
Java zip program produce corrupted zip file
I wanted to write a GUI zip/unzip program with Java. The program will be able to compress any combination of file(s) and directory/ies and decompress one or more compressed files.
Now I've just ...
1
vote
2
answers
1k
views
Invalid zip while compressing with ZipOutputStream
I get invalid zip, when writting to file the following code:
public static byte[] zip(final Map<String, byte[]> mapReports) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
...
1
vote
0
answers
147
views
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 ...
0
votes
1
answer
391
views
Corrupt extraction with ZipArchive in PHP
I have a PHP script that must unzip some uploads. The uploads are packed folders, basically zip files with a custom extension.
I am having problems with some zip files packed in one machine, but not ...
0
votes
1
answer
324
views
Unzip Password Protect Zip file is slow, How to make it fast?
I using the following class for UnZip password-protected file but unzipping to too much slow to fast it or any improvement in such class or method. Thanks in advance.
Class for Unzip Password Protect ...
0
votes
1
answer
176
views
Android Create zip file
I am using this piece of code to create a zip file:
String filename = Helper.Timestamp() + ".zip";
ZipOutputStream out = Helper.CreateZipOutputStream(filename);
Helper.AddZipFolder(out, Helper....
2
votes
1
answer
551
views
Java Reading from n-nested zips, modyfing and writing to new zip preserving original structure
PROBLEM SOLVED IN EDIT 3
I've been struggling with this problem for sometime. All of the questions here in SO or internet seems to work only on 'shallow' structures with one zip inside of another. ...
1
vote
2
answers
564
views
How do I write chinese charactes in ZipEntry?
I want to export a string(chinese text) to CSV file inside a zip file. Where do I need to set the encoding to UTF-8? Or what approach should I take (based on the code below) to display chinese ...
1
vote
0
answers
1k
views
Java: ZipOutputStream to compress chunks of data to single zip file
Follow up of Question: Java: how to compress a byte[] using ZipOutputStream without intermediate file
I can zip data without an intermediate file (or memory file). I now need to zip chunks of data ...
0
votes
1
answer
3k
views
Java: how to compress a byte[] using ZipOutputStream without intermediate file
Requirement: compress a byte[] to get another byte[] using java.util.zip.ZipOutputStream BUT without using any files on disk or in-memory(like here https://stackoverflow.com/a/18406927/9132186). Is ...
0
votes
1
answer
277
views
Mac OS Chrome Browser: Archive Utility (Error 1) - Operation not permitted: Unable to expand downloaded zip
Background: We have written a java code to download zip from web location to local download folder. And downloaded zip is expanding fine with Window(including all browser) but we are facing issue in ...