public Object readPixels(InputStream in) {
       try {
                   bytesPerPixel = 2;
                   return (Object)read16bitImage(in);
       }
       catch (IOException e) {
              e.printStackTrace();
              return null;
       }
   }

解决方案 »

  1.   

    嗯,谢谢,这个问题我已经发现了,但是现在我搞不清如何针对打开的文件调用image reader,
    InputStream具体如何和打开的文件挂钩呢?谢谢
    比如:
    JFileChooser fc=new JFileChooser();
    int returnVal = fc.showOpenDialog(Ir.this);
                 if (returnVal == JFileChooser.APPROVE_OPTION) {
                          File file = fc.getSelectedFile();}
    如何让ImageReader读取?我怎么把file定义给InputStream? 感谢,因为InputStream是abstract.实在搞不定了
      

  2.   

    public Object readPixels(File f) {
           try {
                       bytesPerPixel = 2;
                       return (Object)read16bitImage( new FileInputStream( f ) );
           }
           catch (IOException e) {
                  e.printStackTrace();
                  return null;
           }
       }