Android - Exifinterface E / JHEAD:无法回写 - 没有全部阅读

时间:2015-12-30 05:52:05

标签: java android exif

我正在尝试为解密图像添加一个exif标签。不幸的是它给了我

  

E / JHEAD:无法回信 - 没有全部阅读

关于Logcat的通知并且没有写入exif标签。我在stackoverflow上阅读了所有相似的帖子,但没有可能的答案。

这是我的代码

try {

    FileInputStream fileInputStream = new FileInputStream(f);
    InputStream inputStream = crypto.getCipherInputStream(fileInputStream, new Entity("password"));
    name = getFileName(f.getName());
    extention = getExtention(name,albm);
    File fl = new File(tmp.getPath() + "/" +getFileName(f.getName()) + "." + extention);
    OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(fl));
    byte[] buff = new byte[1024];
    int x = 0;
    while ((x = inputStream.read(buff)) != -1) {
        outputStream.write(buff);
    }

    inputStream.close();
    inputStream=null;
    outputStream.close();
    outputStream=null;
    fileInputStream.close();
    fileInputStream=null;

    ExifInterface exifInterface = new ExifInterface(fl.getPath());

    exifInterface.setAttribute(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_ROTATE_90 + "");
    exifInterface.saveAttributes();

    Log.d("<>File exists?<>", fl.exists() ? "yes" : "noo");

    ExifInterface exifInterface2 = new ExifInterface(fl.getPath());
    String orientation =exifInterface2.getAttribute(ExifInterface.TAG_ORIENTATION);
    Log.d("<>****<>",orientation +"");
    System.gc();

} catch (FileNotFoundException e) {
    e.printStackTrace();
} catch (KeyChainException e) {
    e.printStackTrace();
} catch (CryptoInitializationException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}

0 个答案:

没有答案