首页  >  问答  >  正文

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 天前512

全部回复(1)我来回复

  • 怪我咯

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

    文件损坏 和代码没有关系。。。。

    回复
    0
  • 取消回复