Home  >  Q&A  >  body text

java读取本地png图片到byte数组?

File file = new File(path);
FileInputStream fis = new FileInputStream(file);
byte[] img_content = new byte[(int) file.length()];
fis.read(img_content);
fis.close();

图片是存在的
读入的内容全是0 是什么情况???

黄舟黄舟2743 days ago516

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-04-18 10:56:37

    File corruption has nothing to do with the code. . . .

    reply
    0
  • Cancelreply