Heim  >  Fragen und Antworten  >  Hauptteil

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 是什么情况???

黄舟黄舟2742 Tage vor503

Antworte allen(1)Ich werde antworten

  • 怪我咯

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

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

    Antwort
    0
  • StornierenAntwort