【函数】 | boolean exists(String path) |
【说明】 | 文件或文件夹是否存在。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.exists('file:///system'));
运行示例
|
【函数】 | boolean canRead(String path) |
【说明】 | 文件或文件夹是否可读。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.canRead('file:///system'));
运行示例
|
【函数】 | boolean canWrite(String path) |
【说明】 | 文件或文件夹是否可写。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.canWrite('file:///system'));
运行示例
|
【函数】 | boolean isDirectory(String path) |
【说明】 | 目标路径是否文件夹。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.isDirectory('file:///system'));
运行示例
|
【函数】 | boolean isFile(String path) |
【说明】 | 目标路径是否文件。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.isFile('file:///system'));
运行示例
|
【函数】 | boolean isHidden(String path) |
【说明】 | 目标路径是否是隐藏文件或文件夹。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.isHidden('file:///system'));
运行示例
|
【函数】 | long lastModified(String path) |
【说明】 | 读取文件或文件夹的最后修改时间。 |
【返回】 | 文件或文件夹的最后修改时间。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.lastModified('file:///system'));
运行示例
|
【函数】 | boolean setLastModified(String path, long time) |
【说明】 | 设置文件或文件夹的最后修改时间。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 time:时间戳。 |
【示例】 |
alert(rexseeFile.setLastModified('file:///system',1234567890123));
运行示例
|
【函数】 | long size(String path) |
【说明】 | 读取文件或文件夹的大小。 |
【返回】 | 文件或文件夹的大小。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.size('file:///system'));
运行示例
|
【函数】 | JsonArray dir(String path) |
【说明】 | 读取文件夹中的文件清单,是JSON格式的字符串,代表一个数组,使用"eval('('+json+')')"转换为JavaScript数组对象。 |
【返回】 | 文件夹中的文件清单。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.dir('file:///system'));
运行示例
|
【函数】 | String getParent(String path) |
【说明】 | 读取文件或文件夹的上一层文件夹的路径。 |
【返回】 | 父文件夹的路径。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.getParent('file:///system'));
运行示例
|
【函数】 | boolean newFile(String path) |
【说明】 | 创建新的空白文件,如果需要,会创建整个路径。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.newFile(rexseeStorage.getRoot()+'/testFile'));
运行示例
|
【函数】 | boolean newDir(String path) |
【说明】 | 创建新的文件夹,如果需要,会创建整个路径。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.newDir(rexseeStorage.getRoot()+'/testDir'));
运行示例
|
【函数】 | boolean remove(String path) |
【说明】 | 删除文件或文件夹。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.remove(rexseeStorage.getRoot()+'/testDir'));
运行示例
|
【函数】 | boolean renameTo(String path,String newPath) |
【说明】 | 重命名文件或文件夹。 |
【返回】 | true或false。 |
【参数】 | path:源文件路径,以"file://"开头。 newPath:目标文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.renameTo(rexseeStorage.getRoot()+'/testFile',rexseeStorage.getRoot()+'/testFile2'));
运行示例
|
【函数】 | boolean copyTo(String path,String newPath) |
【说明】 | 复制文件或文件夹。 |
【返回】 | true或false。 |
【参数】 | path:源文件路径,以"file://"开头。 newPath:目标文件路径,以"file://"开头。 |
【示例】 |
alert(rexseeFile.copyTo(rexseeStorage.getRoot()+'/testFile2',rexseeStorage.getRoot()+'/testFile3'));
运行示例
|
【函数】 | boolean putContent(String path,String content, Stirng encode) |
【说明】 | 向文件中写入内容。 |
【返回】 | true或false。 |
【参数】 | path:文件路径,以"file://"开头。 content:要写入的内容。 encode:编码,如"UTF-8"或"GBK"。 |
【示例】 |
alert(rexseeFile.putContent(rexseeStorage.getRoot()+'/testFile2','This is test content.\r\n这是测试内容。','UTF-8'));
运行示例
|
【函数】 | String getContent(String path,String encode) |
【说明】 | 从文件中读取内容。 |
【返回】 | 文件内容。 |
【参数】 | path:文件路径,以"file://"开头。 encode:编码,如"UTF-8"或"GBK"。 |
【示例】 |
alert(rexseeFile.getContent(rexseeStorage.getRoot()+'/testFile2','UTF-8'));
运行示例
|
【函数】 | String getPrivateDir() |
【说明】 | 读取私有文件夹的路径,通过将文件存储在私有文件夹中可以避免用户误删和其它程序访问。 |
【返回】 | 私有文件夹的路径。 |
【参数】 | 无 |
【示例】 |
alert(rexseeFile.getPrivateDir());
运行示例
|
【函数】 | String tryToCleanPrivateDir() |
【说明】 | 删除私有文件夹中所有文件,程序恢复到出厂状态,该功能非常危险,请勿轻易使用。 |
【返回】 | 无 |
【参数】 | 无 |
【示例】 |
alert(rexseeFile.tryToCleanPrivateDir());
运行示例
|