我正在尝试使用Adobe Reader阅读从服务器下载的PDF文件,但问题是当我将其存储在内部存储器中时,其他应用程序无法读取该文件。现在我想知道如何将此文件复制到外部存储器(/sdcard/),以便PDF查看器可以查看。由于安全原因,我将文件存储在内部存储器中,并在之后删除外部存储器中的文件。我的问题是,如何复制保存在内部存储器中的文件,而不使用raw或assets将其放入inputstream。
InputStream myInput = getResources().openRawResource(R.raw.p13);
FileOutputStream fos = openFileOutput("sample", Context.MODE_PRIVATE);
// transfer bytes from the input file to the output file
byte[] buffer = new byte[1024];
int length;
while ((length = myInput.read(buffer)) > 0)
{
fos.write(buffer, 0, length);
}
// Close the streams
fos.flush();
fos.close();
myInput.close();