>  Q&A  >  본문

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일 전517

모든 응답(1)나는 대답할 것이다

  • 怪我咯

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

    파일 손상은 코드와 관련이 없습니다. . . .

    회신하다
    0
  • 취소회신하다