• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to compress DataSize?

 
Amol Chavan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm new to Applets.I have two files,one applet and other class file and I'm trying to pass data from class file to Applet.I'm getting Comma separated values from class file which is my datafetcher file and it's in String format(like "amol,23,java,etc")
I'm retrieving this information in Applet.But I want to compress this data.Size of data is big and I want to compress it so that it should not affect overall page size.

Is it possible to do?
Please help me!!!
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where do you want this data to be compressed - before it gets downloaded to the applet, and then the applet should decompress it? Textual data can be compressed quite effectively. If this is a file, you could use gzip to compress it, and then read it with a GzipInputStream. If it is dynamically generated, something similar could be done.

But instead of speculating, maybe you could describe in more detail what exactly you're trying to do.
[ December 22, 2005: Message edited by: Ulf Dittmer ]
 
Amol Chavan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for ur reply,

I want to display compressed data in Applet.
If its texual data then how to Compress it?
can you explain it to me in more detail about this.
Thanks in Advance......
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello "amolc83"-

On your way in you may have missed that JavaRanch has a policy on display names, and yours does not comply with it - please adjust it accordingly, which you can do right here. Thanks for your prompt attention to this matter.

As regards your question, you still don't say how the data gets to the applet, so it's hard to advise on how to go about this. Assuming that Java streams are involved somehow, have a look at the java.util.zip.GzipInputStream and GzipOutputStream classes.
[ December 22, 2005: Message edited by: Ulf Dittmer ]
 
Amol Chavan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry and I apologize for it and I updated my profile now.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the hint about GzipInputStream and GzipOutputStream make sense to you?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This book has a GZip algorithm implemented via Filter. It might be helpful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic