gpt4 book ai didi

android - java.io.FileNotFoundException : can't create a file because of some error in filename , 仅在某些设备中面临此错误 ex :android 4. 1.2

转载 作者:行者123 更新时间:2023-11-29 16:01:46 25 4
gpt4 key购买 nike

File external = getExternalFilesDir(null);

//fd is stringbuffer whose value is "year1:semester:2"

File file = new File(external,""+fd.toString()+".txt"); // <----error

FileOutputStream fos = new FileOutputStream(file);
fos.write(store.getBytes());
fos.close();

这是生成的异常:

W/System.err(29169): java.io.FileNotFoundException: /storage/sdcard0/Android/data/com.example.ddu/files/Year:1Semester:2.txt: open failed: EINVAL (Invalid argument)

最佳答案

您不能创建名称中包含冒号 (:) 的文件。用其他东西替换冒号。

关于android - java.io.FileNotFoundException : can't create a file because of some error in filename , 仅在某些设备中面临此错误 ex :android 4. 1.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23960885/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com