• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Size of GZIPOutputStream

 
Author
Posts: 144
5
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way to tell the size of GZIPOutputStream? We are trying to figure out how much the compression is helping us. I see nothing in the javadoc and I can understand this would be difficult if not impossible. We are trying to use a compression filter and see if we are adding any value.

Thanks,
Tom
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When in the java.io package, use the Decorator pattern. Here's a CountingOutputStream that lets you count the bytes written to an output stream:You would use one of these to see how many bytes the GZipOutputStream wrote to the output, and another to see how many bytes you wrote to the GZipOutputStream:
 
Tom Henricksen
Author
Posts: 144
5
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul that looks like it will do the trick!
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Often decorators in java.io (e.g. PrintStream and BufferedOutputStream) are expressed using FilterOutputStream or other FilterXXX classes. These give you the standard functionality of wrapping another stream, and forwarding methods calls like flush() and close(). And write(byte[] arr) just calls write(arr, 0, arr.length). So you just add the new functionality:

[ May 11, 2007: Message edited by: Jim Yingst ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic