我在使用imageio读去图片的时候,首先读去了一张580kb的图片,成功读取,但是在读取一张781kb的图片时却提示Exception in thread "Thread-30" java.lang.OutOfMemoryError: Java heap space
,于是我追本溯源找到这段是这么写的:
/** Use the javax.imageio api to read the image. */
    public ImageInformation readImage(String inFile){
        try{
            BufferedImage image = ImageIO.read(new File(inFile));            
            int tempWidth = image.getWidth();
            int tempHeight = image.getHeight();
            
            if ((tempWidth > 0) && (tempHeight > 0)){
                myImage = image;
                myWidth = tempWidth;
                myHeight = tempHeight;
                ImageInformation tempImageInformation = new ImageInformation(image, myImage.getWidth(), myImage.getHeight());
                return tempImageInformation;
            }
            
        }
        catch (Exception e){
        }
        return null;
    }
错误应该就是在那句BufferedImage image = ImageIO.read(new File(inFile));但是我不知道怎么去修改,希望有哪位兄弟帮帮忙!