#Compress String with GZIP
1 messages · Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
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.
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);
Detected code, here are some useful tools:
I currently have this code, my input length is 5947, but my resulting byte array only has the length of 10?
I uploaded your attachments as gist. That way, they are easier to read for everyone, especially mobile users 👍
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
Closed the thread.