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
0
votes
0 answers

Java GZipOutputStream StackOverflowError when zipping TreeSet objects

I encountered a strange StackOverflowError when using GZipOutputStream to zip TreeSet objects into byte[] arrays. The code that does the zipping is pretty standard: ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream zip =…
WillZ
  • 3,775
  • 5
  • 30
  • 38
0
votes
1 answer

Why would I directly rethrow an exception, without error handling

I came around to a piece of code for Base64 encoding. While reading it I stumbled upon something like this: try { // GZip -> Base64 -> ByteArray baos = new java.io.ByteArrayOutputStream(); b64os = new OutputStream( baos, ENCODE…
dertoni
  • 1,763
  • 2
  • 24
  • 47
0
votes
2 answers

Why output is incomplete using OutputStreamWriter with GZIPOutputStream?

I'm hoping someone can shed light on a problem I'm having with the code below. private static String encode(String data) throws IOException { try ( ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream…
Matt R
  • 1,276
  • 16
  • 29
0
votes
1 answer

Can OS X gzip be configured to match Java GZIPOutputStream?

I'm trying to compare the output of running strings through GZIP on both Java, and the CLI gzip command. The outputs are not the same, and I've figure out why, but not sure how to get them to jive with each other. I've read a number of questions on…
Spencer Kormos
  • 8,381
  • 3
  • 28
  • 45
0
votes
1 answer

Compressing the final output data into gzip format

I am getting the final output data in C++ as a string.....Need to compress that data in gzip format.Can someone tell me the way about how to implement it?
0
votes
1 answer

how to download .gz files to the temp folder using GZIPINPUT/GZIPOUTPUT stream

Im downloading all gz format file from X site.After downloading all the files into temp folder when i exact with 0KB ..Pls help me out with code comments..Any changes in the code URL site = new URL (sb.toString()); URLConnection uc =…
0
votes
1 answer

Java GZIPOutputStream: Corrupted gzip with this method

does someone have an idea why this code to create a gzipped string is not working? CLI gzip on a Mac can't open the resulting file: "Not in gz format". Please note: I need the string, not the file. Creating the gzipped file directly works, so does…
user1840267
  • 408
  • 1
  • 5
  • 18
0
votes
1 answer

gzip a folder and its subfolders on the fly

I have a big folder that I want to send a zipped version of it while saving on the sub-folders hierarchy. currently I'm doing it by creating a large zip file and sending it. I'm looking for a way to write the folder content to some outputstream that…
Gal Mazor
  • 100
  • 2
  • 10
0
votes
1 answer

how to compress small string

Possible Duplicate: Best compression algorithm for short text strings i need help in compressing and decompress the string. when i try to compress smaller string it convert into more byte then the original size. but when i add bigger string it…
user1990643
  • 49
  • 2
  • 5
0
votes
1 answer

Java- concatenating compressed data with Deflater or GZIPOutputStream

We have a bunch of threads that take a block of data, compress this data and then eventually concatenate them into one large byte array. If anyone can expand on this idea or recommend another method, that'd be awesome. I've currently got two methods…
user1777900
  • 975
  • 3
  • 13
  • 27
0
votes
3 answers

Calculating Compressed Filesize from GZIPOutputStream

I am compressing File and writing it into outputstream, How to get the compressed file size to put in response header os = response.getOutputStream(); gzos = new GZIPOutputStream(os); fin = new FileInputStream(file); in = new…
Dyapa Srikanth
  • 1,231
  • 2
  • 22
  • 60
-1
votes
1 answer

Java heap out of memory issue while zipping list of nio paths

I am asynchronously running the below method to zip the given set of nio paths. When there are multiple tasks running, java heap out of memory exception is encountered. public InputStream compressToZip(String s3folderName, Set paths) throws…
mwKART
  • 885
  • 2
  • 9
  • 18
-1
votes
1 answer

Convert GZIPOutputStream to byte array

I already have a GZIPOutput stream which has already defined. Now I want to convert it to a byte array. I tried the code below. But it gives an error. GZIPOutputStream zipStream = createGZIP(); byte[] compressedData =…
AnjuT
  • 166
  • 1
  • 4
  • 17
-1
votes
1 answer

Sending A compressed image file via sms on android

I want to know if it's possible to convert an image to a base64 string and then compress it using GZIP and send it to another android phone via SMS where it is decompressed, decoded and then the image is shown to the user? If yes, then what could be…
-1
votes
1 answer

Sending a string to a .Net program from a Java program

I need to send a string to a .Net program from a Java program. I want to take a string from Java and compress it using GZIPOutputStream and decompress it with System.IO.Compression.GZipStream from .Net. ByteArrayOutputStream out = new…
user1542422
  • 309
  • 1
  • 4
  • 13
1 2 3 4 5
6