Questions tagged [zipoutputstream]

ZipOutputStream is used to write ZipEntrys to the underlying stream. Output from ZipOutputStream can be read using ZipFile or ZipInputStream.

A ZipOutputStream is a mechanism for writing data to a stream in a zip-compressed format. A stream is usually comprised of data to write to a local file, or data being transmitted to a remote server over a network protocol such as HTTP or FTP. As the data is given to the ZipOutputStream, it is compressed, and then transmitted to the stream.

170 questions
0
votes
1 answer

Zip file shows empty on trying to extract

I am using the following code to download a set of files stored in my database by putting them into a zip file: SqlDataAdapter adp = new SqlDataAdapter("select FILE_NAME, FILE, content_type from tbl where id = " + "168",…
Adarsh Ravi
  • 893
  • 1
  • 16
  • 39
0
votes
1 answer

Concurrent use of ZipOutputStream uses 100% of CPU

I am working in a feature for an LMS to download a bunch of selected files and folders in a zip on-the-fly. I have used ZipOutputStream to prevent OutOfMemory issues. The feature works nice, but we have done a stress test and when several users are…
0
votes
0 answers

ZipOutputStream.finish() and write file in a wrong directory and Tomcat

when i call .finish() and .close() for a zipOutputStream for download a zip file on a page of my webApp, it saves the content of zip file in my temp user folder ( example: c:/user/appdata/local/temp ) but i want to save this files in…
Alex
  • 111
  • 1
  • 13
0
votes
2 answers

JAVA - Corrupt ZIP file using ZipOutptuStream with FileInputStream

Why might the following code be generating a corrupt zip file when output over a servlet output stream? When writing the ZIP to disk locally using a FileOutputStream, the output stream does not appear to be corrupt. // Create zip…
Hooplator15
  • 1,540
  • 7
  • 31
  • 58
0
votes
2 answers

Android Zipping files

I have a created a directory with some images stored in it. Now, to zip it as a single .zip file, I used the following code : private static void zipDir(String zipFileName, String dir) throws Exception { File dirObj = new File(dir); …
Siddharth Sharma
  • 310
  • 1
  • 2
  • 11
0
votes
0 answers

Store a user defined object in a cell in MS Excel using Apache POI

I have a user defined object that needs to be stored in a cell for each row. As of now I store the value as a String using the below process, (1.) Convert Object to byte[] - Using ByteArrayOutputStream (2.) Convert the byte[] to String - using…
0
votes
0 answers

Different behavior of ZipOutputStream.setLevel(0) in Linux and Windows env

I am trying to optimize a method writeZipResults which take list of ByteOutputStream and convert that into a single zip file as ZipOutputStream. method definition: public void writeZipResults(Map files, OutputStream…
Shashi Shankar
  • 859
  • 2
  • 8
  • 25
0
votes
0 answers

Rename file inside zip in Java

Now I've got a zip file (Dice.zip), inside the zip is a folder(Dice/..) and I want to modify some of the files inside that folder then rename the folder. I've managed to modify the files and rename the zip(from Dice.zip to DiceUp.zip) but when I…
Kira
  • 23
  • 1
  • 5
0
votes
1 answer

Writing xml files into zip file with ZipOutputStream - error when opening

EDIT: The error was not in this code. The download on the front-end was erroneous. The zip on the server was fine but downloading it via js didn't work. I'm writing two xml files into a zip file. I can't open the resulting file (error: no file and…
lisa p.
  • 2,138
  • 21
  • 36
0
votes
1 answer

ZipOutputStream on mp3 corrupts files - Creates data files not audio files

I am using ZipOutputStream in an Android app to package and export mp3 files. The package and export appears to work fine, when the files are extracted, they are not playable. Running file command on the output shows the file type as data. Prior to…
Inn0vative1
  • 2,014
  • 3
  • 27
  • 43
0
votes
1 answer

Android Zipping to Multiple Files

I want to make some Android Studio app for zipping files. Here is the my code block: String input=Environment.getExternalStorageDirectory() +File.separator + "merhaba"; String output = Environment.getExternalStorageDirectory() + File.separator…
Ali.A
  • 11
  • 5
0
votes
1 answer

Java ZipOutputStream writes some files but not others

I am using Java's ZipOutputStream class to write a large zip file. It works fine when the zip file only has 1000 subfiles and subfolders. It also works fine when the zip file only has 10000 subfiles and subfolders. But, for some reason, when I ramp…
0
votes
0 answers

ZipOutputStream create zip with file dont include directories

Looking to take an existing file(xml) and place it in a zip directory. The issue I am encountering is the directories which the xml file are currently residing in are also written to the zip as well. Does anyone have thoughts on this? byte[]…
user2524908
  • 861
  • 4
  • 18
  • 46
0
votes
1 answer

ZipOutputStream creating corrupt (unzippable) zip file

I am trying to send zipped bytes to another server and then have that server receive them and write out the zipped filed. When I do the zipping and writing on the same server it works great. The local version looks something like…
Xerunix
  • 431
  • 1
  • 6
  • 21
0
votes
2 answers

ZipOutputStream ZipEntry is losing milliseconds information

using SharpZipLib in C#, I'm using: // .. ZipEntry entry = new ZipEntry(Path.GetFileName(files[i].fullfilename)); entry.DateTime =files[i].datemodified //has everything including milliseconds //.. some more code which i'm not writing The zip file…
user734028
  • 1,021
  • 1
  • 9
  • 21