Questions tagged [gzipinputstream]

GzipInputStream is a Java class for reading data that are compressed in gzip format. It is also available on Android.

GzipInputStream is a Java class for reading data that are compressed in gzip format. It is also available on Android.

On .NET, there is a similar class called GZipStream: use

125 questions
96
votes
5 answers

GZIPInputStream reading line by line

I have a file in .gz format. The java class for reading this file is GZIPInputStream. However, this class doesn't extend the BufferedReader class of java. As a result, I am not able to read the file line by line. I need something like this reader …
Kapil D
  • 2,662
  • 6
  • 28
  • 30
36
votes
8 answers

GZIPInputStream to String

I am attempting to convert the gzipped body of a HTTP response to plaintext. I've taken the byte array of this response and converted it to a ByteArrayInputStream. I've then converted this to a GZIPInputStream. I now want to read the GZIPInputStream…
Matt
  • 11,157
  • 26
  • 81
  • 110
12
votes
8 answers

Gets the uncompressed size of this GZIPInputStream?

I have a GZIPInputStream that I constructed from another ByteArrayInputStream. I want to know the original (uncompressed) length for the gzip data. Although I can read to the end of the GZIPInputStream, then count the number, it will cost much time…
David Guo
  • 1,749
  • 3
  • 20
  • 30
11
votes
1 answer

Is this a bug in the Java GZipInputStream class?

I noticed that some of my gzip decoding code seemed to be failing to detect corrupted data. I think that I have traced the problem to the Java GZipInputStream class. In particular, it seems that when you read the entire stream with a single 'read'…
Jacob
  • 345
  • 4
  • 11
9
votes
3 answers

How do I get the InputStream of decompressed data from an InputStream of GZIPed data?

I call a service which returns a gzipped file. I have the data as an InputStream (courtesy of javax.activation.DataHandler.getInputStream();) from the response. What I would like to do is, without writing anything to disk, get an InputStream of the…
Ryan Elkins
  • 5,731
  • 13
  • 41
  • 67
8
votes
2 answers

GZIPInputStream closes prematurely when decompressing HTTPInputStream

Question See updated question in edit section below I'm trying to decompress large (~300M) GZIPed files from Amazon S3 on the fly using GZIPInputStream but it only outputs a portion of the file; however, if I download to the filesystem before…
Jeff Harwell
  • 311
  • 1
  • 9
8
votes
9 answers

How do I get Java to use my multi-core processor with GZIPInputStream?

I'm using a GZIPInputStream in my program, and I know that the performance would be helped if I could get Java running my program in parallel. In general, is there a command-line option for the standard VM to run on many cores? It's running on just…
Rudiger
  • 6,634
  • 9
  • 40
  • 57
8
votes
3 answers

Java: Error creating a GZIPInputStream: Not in GZIP format

I am trying to use the following Java code to compress and uncompress a String. But the line that creates a new GZipInputStream object out of a new ByteArrayInputStream object throws a "java.util.zip.ZipException: Not in GZIP format" exception. …
pacoverflow
  • 3,726
  • 11
  • 41
  • 71
8
votes
1 answer

java.util.zip.ZIPException: Not in GZIP format

I am everything but the most experienced JAVA user, however, I am quite desperate regarding my problem. Every time I execute the below code, I receive the following error: java.util.zip.ZipException: Not in GZIP format at…
user1766413
  • 83
  • 1
  • 1
  • 3
8
votes
3 answers

How to read compressed HTML page with Content-Encoding : gzip

I request a web page that sends a Content-Encoding: gzip header, but got stuck how to read it.. My code: try { URLConnection connection = new URL("http://jquery.org").openConnection(); String html = ""; …
ilyes kooli
  • 11,959
  • 14
  • 50
  • 79
7
votes
2 answers

Java: How do I convert InputStream to GZIPInputStream?

I have a method like public void put(@Nonnull final InputStream inputStream, @Nonnull final String uniqueId) throws PersistenceException { // a.) create gzip of inputStream final GZIPInputStream zipInputStream; try { …
daydreamer
  • 87,243
  • 191
  • 450
  • 722
6
votes
3 answers

Dataflow GZIP TextIO ZipException: too many length or distance symbols

Using TextIO.Read transform with a large collection of compressed text files (1000+ files, sizes between 100MB and 1.5GB), we sometimes get the following error: java.util.zip.ZipException: too many length or distance symbols…
Fematich
  • 1,588
  • 14
  • 26
6
votes
5 answers

How to decompress a gzipped data in a byte array?

I have a class which has a method that is receiving an object as a parameter. This method is invoked via RMI. public RMIClass extends Serializable { public RMIMethod(MyFile file){ // do stuff } } MyFile has a property called…
rshepherd
  • 1,396
  • 3
  • 12
  • 21
6
votes
2 answers

Stream decoding of Base64 data

I have some large base64 encoded data (stored in snappy files in the hadoop filesystem). This data was originally gzipped text data. I need to be able to read chunks of this encoded data, decode it, and then flush it to a GZIPOutputStream. Any…
James Isaac
  • 2,587
  • 6
  • 20
  • 30
5
votes
2 answers

GZIPInputStream and Characterset

I have a Text with Latin, Cyrillic and Chinese Characters containing. I try to compress a String (over bytes[]) with GZIPOutputStream and decompress it with GZIPInputStream. But I do not manage to convert all Characters back to the original…
mcflysoft
  • 51
  • 2
1
2 3
8 9