您好,我正在尝试打开一个文档文件在快速办公室从我的应用程序,但它似乎不允许访问从我的内部存储的文件。所以我想要做的是将文件从内部存储移动到外部存储上的临时文件夹,这样当它可以通过快速办公打开时?有没有人知道这是否可能
发布于 2014-01-30 06:19:19
String source = // Internal file path
String destination = getExternalCacheDir() + "/" + UUID.randomUUID();
FileInputStream fis = new FileInputStream(source);
FileOutputStream fos = new FileOutputStream(destination);
byte[] buf = new byte[1024];
int len;
int total = 0;
while ((len = fis.read(buf)) > 0) {
total += len;
fos.write(buf, 0, len);
if (total > 20 * 1024) {
fos.flush();
}
}
fis.close();
fos.close();https://stackoverflow.com/questions/21443607
复制相似问题