in = new BufferedInputStream(httpUrl.getInputStream());
java.awt.image.BufferedImage img = javax.imageio.ImageIO.read(in);
String filename=filepath+"/"+imgname;
File file = new File(filename);
if (!file.exists()) {
FileOutputStream out = new FileOutputStream(file);
byte[] buf = new byte[1024];
int len = 0;
while ((len = in.read(buf)) != -1) {
out.write(buf, 0, len);
}
}
去掉第二行代码之后是正常的,加上第二行代码in这个输入流就读不到任何数据了,为什么?