首頁  >  問答  >  主體

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

全部回覆(1)我來回復

  • 怪我咯

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

    檔案損壞 和程式碼沒有關係。 。 。 。

    回覆
    0
  • 取消回覆