?
Solved

util.zip package

Posted on 1998-05-28
1
Medium Priority
?
150 Views
Last Modified: 2010-04-16
Has anyone worked with the util.zip package? I´m trying to compress with it some images that I have in a int which I obtain after using PixelGrabber.

I have tried with classes Deflater and Inflater, but with a very simple example they don't seem to work properly.

Any example would be very helpful

Thanks in advance
0
Comment
Question by:Jose Luis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
muesli earned 300 total points
ID: 1221641
The easiest way to use the compression that comes with Java is to use the classes:

GZIPInputStream, GZIPOutputStream, ZipInputStream, ZipOutputStream.

For example, let's say you're saving the image data to a file.  At some point in your code you've got something like this:

OutputStream out = new FileOutputStream( filename );

Replace it with the following:

OutputStream out = new ZipOutputSream(
                         new FileOutputStream( filename ) );

...and then you just use "out" as you normally would. (Wrapping it in a BufferedOutputStream, for example.)

This works analagously for InputStreams, as well as for streams other then FilexxxStream.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month8 days, 19 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question