Android デバイスを使用して画像を取得するときに Oracle MAF 2.1.0.0.41 を使用しています。この画像のパスは次のとおりです:file:/storage/emulated/0/Android/data/com.example.app /142416553.jpg
Java Bean クラスを使用してこの画像にアクセスしようとしました:
try {
Object imageSource = (Object) AdfmfJavaUtilities.evaluateELExpression("#{bindings.Return.inputValue}");
String path = (String) imageSource;
path = "***path: " + path;
File f = new File(path);
path = path + f.exists() + f.canRead() + f.canWrite() + " "+imageSource.getClass();
InputStream is = new BufferedInputStream(new FileInputStream(path));
InputStreamReader rdr = new InputStreamReader(is, "UTF-8");
StringBuilder contents = new StringBuilder();
char[] buff = new char[4096];
int len = rdr.read(buff);
while (len >= 0) {
contents.append(buff, 0, len);
}
System.out.println("***Output: " + buff.toString());
image = buff.toString();
} catch (FileNotFoundException e) {
image =" ***Error FileNotFoundException: " + e.getMessage();
} catch (IOException e) {
image = "***Error IOException: " + e.getMessage();
} catch (Exception e) {
image = "***Error Exception: " + e.getMessage();
}
しかし、私はこのエラーに直面しました: No such file or directory cannot Read, write and not exist.
誰でも私を助けることができます!キャッシュディレクトリから画像を読み取る方法。