2
현재 웹 보관 파일을 저장 한 다음 FileInputStream으로 가져 오는 다음 코드가 있습니다. 그러나, 웹 콘텐츠 내에서 채널은 널 (null) 남아 FileNotFoundException이가 발생합니다 :저장된 파일에 액세스하려고 할 때 context.openFileInput()이 null을 반환합니다.
// Save the Web Archive once loading is finished
String path = context.getFilesDir().getAbsolutePath()
+ File.separator + WEB_PREFIX + postId;
webView.saveWebArchive(path);
FileInputStream webContent = null;
try {
webContent = context.openFileInput(WEB_PREFIX + postId);
} catch (FileNotFoundException e) {
Log.d("onPageFinished()", "FileNotFoundException");
e.printStackTrace();
}
내가 context.openFileInput (경로)를 수행하려는 경우 대신, 내가
이 가09-05 23:39:42.448: E/AndroidRuntime(8399): java.lang.IllegalArgumentException: File /data/data/com.example/files/web-2189241737372651547 contains a path separator
가
누구 해결책을 알고 있나요거야? 파일은 이전 행에 저장 했으므로 확실히 존재합니다.
답장을 보내 주셔서 감사합니다. 나는 그것을 시도하고 "webContent = new FileInputStream (path);", 그러나 그들은 둘 다 FileNotFoundException을 제공합니다. – cheese1756
@ cheese1756 내 편집을 확인하십시오. – nedaRM
나는 당신의 편집을 시도했다. 파일이 null이 아닙니다 (위대입니다!) 경로는 문자열에 지정된 경로와 같습니다. 나는 또한 adb를 확인하고 그 파일이 실제로 거기에 있다는 것을 확인했다 (그것은!). 남은 유일한 질문은 "webContent = new FileInputStream (path);"입니다. File이 작동하지 않습니다. – cheese1756