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
1
vote
1 answer

How to handle a GZIP String from message body API response?

I'm working with a system that returns a GZIP string (not a binary or stream) in its response. For example,…
SW Williams
  • 559
  • 1
  • 5
  • 18
1
vote
1 answer

Decompressing Gzipped Json Files

I've been having some trouble with recieving a compressed Gzip file in java. When I run the following code to recieve it: HttpClient httpClient = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() …
1
vote
1 answer

java.io.EOFException: Unexpected end of ZLIB input stream during reading stream data

Below code is used to read data from an API. Stream of data from the API is in gzip encoding. When single API is hit then data comes correctly but when few APIs (different) are hit at the same time using multi threading then it throws below…
Rohit Kumar
  • 103
  • 2
  • 17
1
vote
1 answer

GZIPInputStream end-of-file sequence in BufferedReader

I use a Java BufferedReader object read, line-by-line, a GZIPInputStream that points to a valid GZIP archive that contains 1,000 lines of ASCII text, in typical CSV format. The code looks like this: BufferedReader buffer = new BufferedReader(new…
PNS
  • 19,295
  • 32
  • 96
  • 143
1
vote
0 answers

EntityUtils.toString throws java.io.EOFException when content length is not provided in response header

I am making an HTTP Get call using Apache HTTPClient (4.x). httpResponse = httpClient.execute(call, context); HttpEntity responseEntity = httpResponse.getEntity(); content = EntityUtils.toString(responseEntity); It throws the following…
1
vote
1 answer

java renaming contents of zip/gz file without inflating

For .zip file we have, in Java, ZipInputStream and ZipOutputStream for reading from and writing to zip file. zin = new ZipInputStream(new FileInputStream("xx.zip")); ZipEntry entry = zin.getNextEntry(); while (entry != null) { …
Dr. Debasish Jana
  • 6,980
  • 4
  • 30
  • 69
1
vote
2 answers

Unable to serialize convert java POJO class into a byte array

How to convert java POJO class into a byte array as I wanted to save the object into a gz file in S3 I get this exception Caused by: java.io.NotSerializableException public byte[] compressData(User user) throws IOException { byte[]…
Harish
  • 565
  • 1
  • 12
  • 34
1
vote
2 answers

How can I read octet-stream to plain string/text by using java?

I have some content coming from a byte[] which stands for the data from the request which gets saved to a .txt file. try { while ((bytesRead = streamFromClient.read(currentRequest)) != -1) { LOG.info("Received…
Irinel
  • 79
  • 1
  • 1
  • 8
1
vote
2 answers

GZIPInputStream unable to decode at receiver side (invalid code lengths set)

I'm attempting to encode a String in a client using GZIPOutputStream then decoding the String in a server using GZIPOutputStream. The client's side code (after the initial socket connection establishment) is: // ... Establishing connection, getting…
amirkr
  • 173
  • 3
  • 15
1
vote
0 answers

How to gzip then unzip a string without going to the filesystem in Java?

Desired: Create compress and uncompress a string or byte array. After that I plan to Base64 encode it for writing to a log file. Unfortunately, it looks like it is not recognizing it as being compressed or something. I'm assuming that it is missing…
ScrappyDev
  • 2,307
  • 8
  • 40
  • 60
1
vote
2 answers

How can I gzip an InputStream and return an InputStream?

I am starting with a response from a HTTP request: InputStream responseInputStream = response.getEntityInputStream() I need to gzip that response so I can upload it to s3 and save it compressed: this.s3.putObject(new PutObjectRequest(bucketName,…
chaimp
  • 16,897
  • 16
  • 53
  • 86
1
vote
0 answers

Facing java.util.zip.ZipException: invalid bit length repeat

I have large Base64 Encoded Gzipped data stored in a .tmp file in tomcat temp folder. This data is originally gzipped text data. I need to be able to read chunks of this encoded data, decode it, and then unzip it using GZIPInputStream. But I am…
Manoj Dudhe
  • 11
  • 1
  • 3
1
vote
0 answers

HTTP connection closed while reading GZIP compressed input streams

I need to process large gzip-compressed text files. InputStream is = new GZIPInputStream(new FileInputStream(path)); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line; while ((line = br.readLine()) != null) { …
1
vote
0 answers

Error: Not in GZIP format - attempt to decompress GZIP stream previously stored in a database field

Streaming confuses me - just when I think I'm grasping the idea, my code goes belly up. I'm attempting to take in a string, gzip compress it, and store it in a PostGreSQL database. THEN I want to get it back out and re-transform it into an output…
1
vote
1 answer

GZIPInputStream is prematurely closed when reading from s3

new BufferedReader(new InputStreamReader( new GZIPInputStream(s3Service.getObject(bucket, objectKey).getDataInputStream()))) creates Reader that returns null from readLine() after ~100 lines if file is greater then several MB. Not…
Denys
  • 23
  • 6
1 2 3
8 9