Questions tagged [gzipoutputstream]

GzipOutputStream is a Java class for writing data that will be compressed in gzip format. It is also available on Android.

GzipOutputStream is a Java class for writing data that will be compressed in gzip format. It is also available on Android.

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

90 questions
1
vote
1 answer

file corrupted when I post it to the servlet using GZIPOutputStream

I tried to modify @BalusC excellent tutorial here to send gziped compressed files. This is a working java class : import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import…
Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361
1
vote
1 answer

How to read GZIP Object input, Java

I got an Object which I want to send over a Socket. For the Ouput I got: Socket s = serverSocket.accept(); ObjectOutputStream dout = new ObjectOutputStream(new GZIPOutputStream(s.getOutputStream())); Msg m = new Msg("123", "123",…
nZeloT
  • 63
  • 1
  • 2
  • 7
0
votes
1 answer

byte array gzip and base64 encoding results in OOM error upon retrieval and decode+unzip at high load

We have an XML document of size 1.4MB which we gzipCompress and encode to Base64 and save in cosmos. Upon receiving some updates, we read cosmos, decode from base64 and unzip to get the original string. What we are observing is at some high load the…
0
votes
2 answers

Compressing byte[] to byte[] with GZIPOutputStream? Unexpected end of ZLIB input stream

I am trying to compress and array of bytes into another array of bytes using GZIPOutputStream (in Java). This is my code: @Test public void testCompressBytes() throws IOException { final byte[] uncompressed =…
0
votes
0 answers

Why does Files.copy cause out of memory error when creating large file

I have a simple method that creates a tar file with a collection of compressed files inside: private byte[] gzipCompress() throws IOException { File source = super.getPath(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); …
user1472672
  • 313
  • 1
  • 9
0
votes
0 answers

Why is my GzipOutputStream starting with 10 bytes and never changing?

I'm trying to write some bytes to a Gzip-compressed and ChaCha20-encrypted output stream to recreate an HmacBlock of a KDBX4 file. Below is how I declare and initialize the streams: //needed for determining # of bytes written and resetting to 0…
noG23
  • 93
  • 2
  • 7
0
votes
1 answer

google::protobuf::io::GzipOutputStream does not write anything if the file handle is closed at the end

The following code writes to file as expected int ofd = open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0777); google::protobuf::io::FileOutputStream outp(ofd); google::protobuf::io::GzipOutputStream fout(&outp); MyMessage msg; …
John Jiang
  • 827
  • 1
  • 9
  • 19
0
votes
1 answer

Java's GZIPOutputStream refuses to flush

Here is a JUnit test that demonstrates my issue: package stream; import static org.junit.jupiter.api.Assertions.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import…
spierepf
  • 2,774
  • 2
  • 30
  • 52
0
votes
1 answer

Python gzip and Java GZIPOutputStream give different results

I'm trying to take hash of gzipped string in Python and need it to be identical to Java's. But Python's gzip implementation seems to be different from Java's GZIPOutputStream. Python gzip: import gzip import hashlib gzip_bytes =…
PATAPOsha
  • 372
  • 3
  • 18
0
votes
1 answer

org.apache.hadoop.io.compress.GzipCodec, in this class GzipOutputStream is not closed, so memory leak

org.apache.hadoop.io.compress.**GzipCodec, in this class GzipOutputStream is not closed, so memory leak. How to close GzipOutputStream? Or other stream should also be closed? Is there a good alternative? spark version is 2.1.0 and hadoop version…
gnnExplorer
  • 113
  • 1
  • 2
  • 12
0
votes
1 answer

Unirest post with GZIPOutputStream not working with python Flask api

Getting following error while posting compressed payload from Java client (Unirest) to Flask Api. [POST]>. Error 400 Bad Request: Failed to decode JSON object: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte while…
Rajan Sharma
  • 325
  • 1
  • 4
  • 11
0
votes
0 answers

read zipped ion content from s3 in java

I have a backend service that writes a file created using GZipOutputStream to S3 and the front end wants to display the ION content in it. I tried using GZipInputStream to wrap the InputStream returned by the S3Object getObjectContent() method, but…
0
votes
1 answer

Determining GZIPOutputStream behavior

The following code produces files which is deterministic (shasum is the same) for two strings. try( FileOutputStream fos = new FileOutputStream(saveLocation); GZIPOutputStream zip = new GZIPOutputStream(fos,…
ergonaut
  • 6,929
  • 1
  • 17
  • 47
0
votes
0 answers

Why Java GzipOutputStream always write two bytes 03 00 before the trailer if flush() is called first then closed?

I found that when using Java.util.zip.GzipOutputStream, when I called flush() first then close(). The deflator always produce two bytes ('00' and '03' in hex) before writing the trailer. What does these two bytes mean? Why flush() does not flush all…
Snakienn
  • 529
  • 5
  • 12
0
votes
0 answers

Uncompress Gzip data using SQL

We have a service which store the compressed data in the data store(SQL table). This data is compressed using java util library GZIPOutputStream. My question is is there a way to uncompress this data using SQL? Sample compressed…
Jhutan Debnath
  • 505
  • 3
  • 13
  • 24