Код: Выделить всё
/storage/emulated/0/Documents/com.xyz.jscean01/SERVICE.TXT: open failed: EACCES (Permission denied)Я попробовал все возможные способы, и он не работал. См. Режисскую разрешение < /p>
Код: Выделить всё
-rw-rw---- 1 root everybody 9018 2022-03-07 12:15 SERVICE.MМожет ли кто -нибудь может помочь мне прочитать этот текстовый файл
Если я могу получить рабочий код в Java, я буду признателен.
Код: Выделить всё
public boolean CopyFileFromDocumentsDir(String strInputFileName, String strOutputFileName) throws Exception
{
File fExternalStorageDir = null;
File fFile = null;
try
{
fExternalStorageDir = CreateExternalDir("/com.xyz.jscean01");
}
catch(Exception ex)
{
throw ex;
}
fFile = new File(fExternalStorageDir, strInputFileName);
if ( !fFile.exists() )
{
strMessage = "Import File" + "File: \n" + fFile.getPath() + " does not exist !";
CJSCGeneral.WriteLog(strTmpStr); // Here i get error
return false;
}
int length = (int) fFile.length();
byte[] bytes = new byte[length];
FileInputStream in = new FileInputStream(fFile);
try
{
in.read(bytes);
}
catch(Exception ex)
{
throw ex;
}
finally
{
in.close();
}
String strData = new String(bytes);
CJSCLib.DeleteFile(strOutputFileName);
CJSCGeneral.WriteToFile(strOutputFileName, strData.toString());
return true;
}
public File CommonDocumentDirPath(String FolderName)
{
File dir = null;
dir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + "/" + FolderName);
// Make sure the path directory exists.
if (!dir.exists())
{
// Make it, if it doesn't exit
boolean success = dir.mkdirs();
if (!success)
{
dir = null;
}
}
return dir;
}
public File CreateExternalDir(String strDirName)
{
File fFile = CommonDocumentDirPath(strDirName);
if (!fFile.exists())
{
fFile.mkdirs();
}
return fFile;
}
-;
serviceno copy-ошибка исключения:
/storage/emulate/0/documents/com.xyz.jscean01/service.m: Open Fail: EACCES (разрешение DEFSISIED) AT 24092025 104038
Подробнее здесь: https://stackoverflow.com/questions/797 ... -java-code
Мобильная версия