ProgressMonitorInputStream

Can anyone please tell me how to assign ProgressMonitorInputStream to the following code? So that we can see how far the process has completed.
     
ArrayList images=new ArrayList();

     ZipInputStream zin = new ZipInputStream(new FileInputStream(filename));
     ZipEntry zent=     zin.getNextEntry();
     JPEGImageDecoder decoder1=JPEGCodec.createJPEGDecoder(zin);
     BufferedImage bi1=decoder1.decodeAsBufferedImage();
     AffineTransformOp aop1=new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BILINEAR);
     BufferedImageFilter bif1=new BufferedImageFilter(aop1);
     FilteredImageSource fsource1=new FilteredImageSource(bi1.getSource(), bif1);
     Image img1=Toolkit.getDefaultToolkit().createImage(fsource1);



     images.add(new ImageIcon(img1, "Map"));
     zin.closeEntry();
     zent=zin.getNextEntry();

     while(! zent .getName().equals("data.ser"))
         {
          JPEGImageDecoder decoder2=JPEGCodec.createJPEGDecoder(zin);
          BufferedImage bi2=decoder2.decodeAsBufferedImage();
          AffineTransformOp aop2=new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BILINEAR);
          BufferedImageFilter bif2=new BufferedImageFilter(aop2);
          FilteredImageSource fsource2=new FilteredImageSource(bi2.getSource(), bif2);
          Image img2=Toolkit.getDefaultToolkit().createImage(fsource2);
          String imgName=new File(zent.getName()).getName();
          images.add(new ImageIcon(img2, imgName.endsWith(".jpg")?imgName.substring(0,imgName.length()-4):imgName));
          zent=zin.getNextEntry();
         }

     ObjectInputStream oin = new ObjectInputStream(zin);

     Object data= oin.readObject();

     zin.closeEntry();
csoundAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
It would be more appropriate IMHO to use a progress monitor on zip entries rather than use ProgressMonitorInputStream
0
objectsCommented:
ZipInputStream zin = new ZipInputStream(
   new ProgressMonitorInputStream(comp, "Unzipping...",
new FileInputStream(filename)));
   
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
objectsCommented:
ZipInputStream zin = new ZipInputStream(
   new ProgressMonitorInputStream(comp, "Unzipping...",
new FileInputStream(filename)));
   
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

csoundAuthor Commented:
-> CEHJ
what's IMHO?
0
CEHJCommented:
in my humble opinion. But give it a try with objects' suggestion first.
0
csoundAuthor Commented:
The progress monitor does not get displayed..
0
objectsCommented:
It may not need to, it only displays if the reading takes a while.
How big is your zip file?

http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html

0
csoundAuthor Commented:
The progress monitor does not get displayed..
0
objectsCommented:
You can adjust the settings using the ProgressMonitor class.
0
csoundAuthor Commented:
The file size was about 70K.
0
csoundAuthor Commented:
So I have to
ProgressMonitorInputStream pmi=new ProgressMonitorInputStream(comp, "Unzipping...",
new FileInputStream(filename));

ProgressMonitor pm=pmi.getProgressMonitor();
//do some setting

ZipInputStream zin = new ZipInputStream(
pmi);

Is this correct?
0
CEHJCommented:
It seems to me the processing overhead is confined to what's going on in your loop, which is a good reason why the progress monitor should not be attached to the input stream
0
objectsCommented:
csound> Is this correct?

yes

cehj> It seems to me the processing overhead is confined to
cehj> what's going on in your loop, which is a good reason why
cehj> the progress monitor should not be attached to the input stream

But the loop is reading the stream?

0
CEHJCommented:
I suppose if the next read of the stream is going to have to wait on the processing, then it can be made to amount to the same thing yes.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.