我正在使用这种方法来展示我的BufferedImage:
public void setUriFromInpustream(InputStream in) {
BufferedImage bimg;
try {
bimg = ImageIO.read(in);
originAspectRatio = (double) bimg.getWidth() / (double) bimg.getHeight();
if (width == 0)
width = bimg.getWidth();
if (height == 0)
height = bimg.getHeight();
setPreserveOriginAspectRatio(preserveOriginAspectRatio);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
和bimg.getWidth()正在bimg.getHeight()向我展示NullPointerException。
有什么解决办法吗?
斯蒂芬大帝
相关分类