Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

GZIP Compression without headers  RSS feed

 
Santosh Kumar Nayak
Ranch Hand
Posts: 193
Eclipse IDE IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone tried GZIP compression ?

Can we have the compressed data without any headers ?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using GZIP compression is extremely common, although in many cases it's applied automatically.

What do you mean by:
the compressed data without any headers
 
Santosh Kumar Nayak
Ranch Hand
Posts: 193
Eclipse IDE IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the data is compressed then in that scenario we get the compressed data.

Now Compressed data= Header+ actual data

Can we have only "actual data" in the compressed form ?
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GZIP or for that matter any protocol have specific protocol headers to understand the real data. If you remove those protocol parts then it's no longer GZIP. What exactly are you trying to do?
 
Santosh Kumar Nayak
Ranch Hand
Posts: 193
Eclipse IDE IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We were trying to compress some data via Java and C language.

Now there was a mismatch in the header part of the compressed data hence I had the query if we can remove the header information.
 
Tony Docherty
Bartender
Posts: 3270
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure they are both using the GZIP compression algorithm.
 
Santosh Kumar Nayak
Ranch Hand
Posts: 193
Eclipse IDE IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, they both are using the same zipping algorithm still the in-consistency is present.

Hence we are planning to use Zlib and perform compression from both the platforms.
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you did not ovelook something?
 
Tony Docherty
Bartender
Posts: 3270
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's extremely unlikely the the Java GZIP classes are platform dependent. It goes against everything Java stands for.
Compressing on one platform and de-compressing on another using the standard library must be possible or the classes would be next to useless.

Unless you show us the code you are using (ideally an SSCCE) it's not possible to advise on how to resolve the issue.
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based on the OP's other thread dealing with GZIP I would say that there is a good chance that he is converting the bytes of the GZIP output to a String ignoring the fact that they are binary. The transformation 'binary bytes' ( using new String(bytes) )-> String -> "binary bytes' (using String.getBytes()) is not guaranteed to get back the original bytes; it depends on the character encoding used and this simplistic approach cannot be recommended.
 
Tony Docherty
Bartender
Posts: 3270
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Richard, I hadn't read the OP's other thread.

The thread Richard is referring to is http://www.coderanch.com/t/616879//java/Stream-Bytes
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!