FileInputStream fi=new FileInputStream(path1);
byte data[]=new byte[fi.available()];
fi.read(data);

解决方案 »

  1.   

    java.io.BufferedInputStream bis=new java.io.BufferedInputStream(new java.io.FileInputStream("img.jpg"));
    byte[] b=new byte[bis.available()];
    bis.read(b);
      

  2.   

    搞错了。。是内存中的图片。。不在硬盘上
       还有.available()不是准的返回流的深度
    .read()也只能读buffsize个字节
      

  3.   

    java.io.BufferedInputStream bis=new java.io.BufferedInputStream(new java.io.FileInputStream("img.jpg"));
    byte[] buffer = new byte[1024]; 
    int readCount; 
    while((readCount = bis.read(buffer)) > 0) { 
    bis.read(buffer, 0, readCount);