0

Prior to updating my netbeans IDE to 1.4, I was using the 1.3 version and I was working on a java app that could compress multi-page tiff images. One of the methods in that project was a method to get the bit depth of the image using the ImageIO methods. The method was as follows:

    private synchronized void setBitDepth()
    {
       if(this.getImageInputStream() == null)
       {
           System.out.println("ImageInputStreamFailure");
       }
       try
       {
           //System.out.println("Path: " + this.testTiff);
           ImageInputStream testInStream = ImageIO.createImageInputStream(new File(this.testTiff)); //test
           Iterator<ImageReader> readers = ImageIO.getImageReaders(testInStream);
           ImageReader reader;
           if(!readers.hasNext())
           {
               throw new IOException("Cant read format...");
           }
           else
           {
               reader = readers.next();
           }
           reader.setInput(this.getImageInputStream(), true, true);
           this.bitDepth = reader.getImageTypes(0).next().getColorModel().getPixelSize();
           reader.dispose();
       }
       catch(IOException e)
       {
           e.printStackTrace();
       }

    }

This method worked fine in the 1.3 IDE, but as soon as I updated to 1.4 this method always throws the "Cant read format..." exception. What would cause this?

4

0 回答 0