zipinputstream

What's with Ruby's ZipInputStream screwing up my line endings?

I'd be happy with ZipInputStream taking indecent liberties with the line endings that are stored in a file if it would at least get them right for the platform I'm storing the file on. Unfortunately, I pull a text file (.txt, .cpp. .etc.) out of a zip and the \n (0x0A) gets replaced with a \r\n (0x0d0a) and, as you can imagine, this is ...

Randomly accessing a compressed file without using ZipFile (since ZipFile has a major bug).

I know, I know, who would want to compress or uncompressed large files in java. Completely unreasonable. For the moment suspend disbelief and assume I have a good reason for uncompressing a large zip File. Issue 1: ZipFile has a bug (bug # 6280693), sun has fixed this in java 1.6 (Mustang). The fix isn't isn't helpful as our software ne...

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 the entries and their names. However I cannot see an easy way to extract the contents of ea...

Getting IOException Push back buffer is full while trying to unzip a String value using ZipInputStream

I am trying to unzip a String value. But I am getting a java.io.IOException: Push back buffer is full public byte[] unzipArray(String stringToUnzip) { byte[] inputByteArray = Base64.decode(stringToUnzip); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream( inputByteArray)...

Getting document.xml from a docx file using ZipInputStream

Hello, 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); ZipEntry zipEntry; while ((zipEntry = docXFile.getNextEntry()) != null) { ...

How can I avoid mutable variables in Scala when using ZipInputStreams and ZipOutpuStreams?

I'm trying to read a zip file, check that it has some required files, and then write all valid files out to another zip file. The basic introduction to java.util.zip has a lot of Java-isms and I'd love to make my code more Scala-native. Specifically, I'd like to avoid the use of vars. Here's what I have: val fos = new FileOutputStream("...

Problem opening/downloading zip-file after decompression (Java/ZipInputStream)

The background Currently, I try to get a zip-file through a HTTP-servlet with a HTTP-request. The received zip-file contains three different files. These files contain information I want to filter out and doing this from the source is not an option (that's just how it is, though I am aware it would be much better). Because I cant filt...

How do I read multiple ZipEntries through a single InputStream

Hi, I have to pass an InputStream as a parameter to a 3rd party library, which will read the complete contents from the InputStream and do its job. My problem is, some of my files are Zip files - with more than one ZipEntry. From what I understand, one can read one zipEntry at a time and then do a zipInputStream.getNextEntry() and the...

System.IOException when opening file with File.OpenRead

I get the following exception when I open a file for unzipping it's contents. It happens when I have the file selected in Windows Explorer, or mouse over it showing a tooltip. System.IO.IOException was unhandled Message=The process cannot access the file 'D:\Documents\AutoUnZip\Zips\MVCContrib.Extras.release.zip' because it is being u...

How to preprocess ZipInputStream of XML data before deserialization?

In .NET and C#, I have some XSD generated class with root and type attributes set to [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://example.com")] [System.Xml.Serialization.XmlRootAttribute("myRootElement", Namespace="http://example.com", IsNullable=false)] Furthermore, I have files containing XML data from different sou...

ZipInputStream Throws Illegalargument exception for diacritics

Hi, If I run the below program with the zip file which has some files with diacritic characters (e.g 1-2GF-969##JÖN.pdf) , I get IllegalArgumentException. My application has to support all languages. So, we set encoding to UTF-8 All languages work fine. But the problem comes when reading diacritic characters. I tried using alternati...

How to reuse / reset an ZipInputStream?

I want to reset the ZipInputStream (ie back to the start position) in order to read certain files in order. How do I do that? I am so stucked... ZipEntry entry; ZipInputStream input = new ZipInputStream(fileStream);//item.getInputStream()); int check =0; while(check!=2){ entry = input.getNextEnt...