#Compress String with GZIP

1 messages · Page 1 of 1 (latest)

marsh ploverBOT
#

<@&987246399047479336> please have a look, thanks.

marsh ploverBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

mellow trout
#
        System.out.println(in.length());
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        GZIPOutputStream gos = new GZIPOutputStream(outputStream);
        gos.write(in.getBytes());
        gos.flush();
        System.out.println(outputStream.toByteArray().length);
marsh ploverBOT
mellow trout
#

I currently have this code, my input length is 5947, but my resulting byte array only has the length of 10?

marsh ploverBOT
#

I uploaded your attachments as gist. That way, they are easier to read for everyone, especially mobile users 👍

mellow trout
#

String length 5947, bytes of my String is also length 5947, the final gzipped array bytes has a length of 10

#

I think 10 is just the length of the gzip header aswell if im not mistaken

#

so it wrote exactly nothing?

#

ah I wrote to the wrong stream

#

my bad

marsh ploverBOT
#

Closed the thread.