android java.io.file_Android:java.io.File

An "abstract" representation of a file system entity identified by a pathname. The pathname may be absolute (relative to the root directory of the file system) or relative to the current directory in which the program is running.

对文件系统实体的一个抽象表现,用路径名来识别,可以使绝对路径也可以是相对路径

The actual file referenced by a File may or may not exist. It may also, despite the nameFile, be a directory or other non-regular file.

被File对象所引用的文件,可能存在也可能不存在。也可能是目录或其它不常见的文件

This class provides limited functionality for getting/setting file permissions, file type, and last modified time.

On Android strings are converted to UTF-8 byte sequences when sending filenames to the operating system, and byte sequences returned by the operating system (from the variouslist methods) are converted to strings by decoding them as UTF-8 byte sequences.

Android字符串与操作系统以UTF-8字节流的形式传递

Public Constructors

File(File dir, String name)

Constructs a new file using the specified directory(目录文件File) and name(文件名字符串).

File(String path)

Constructs a new file using the specified path(路径字符串).

File(String dirPath, String name)

Constructs a new File using the specified directory path(路径字符串) and file name(文件名字符串), placing a path separator(路径分隔符) between the two.

File(URI uri)

Constructs a new File using the path of the specified URI.

String[]

list()

Returns an array of strings with the file names in the directory represented by this file.

当前文件如果是目录文件,返回此目录中的文件(字符串数组),如果当前文件不是目录文件,返回NULL。

表示当前目录的(.)和表示父目录的(..)不作为数组的一部分返回。

String[]

list(FilenameFilter filter)

Gets a list of the files in the directory represented by this file.

File[]

listFiles()

Returns an array of files contained in the directory represented by this file.

返回当前目录中的文件(文件数组)。当前路径如果是绝对路径,返回的文件也是绝对路径。当前路径如果是相对路径,返回的文件也是相对路径。

File[]

listFiles(FilenameFilter filter)

Gets a list of the files in the directory represented by this file.

File[]

listFiles(FileFilter filter)

Gets a list of the files in the directory represented by this file.

static File[]

listRoots()

Returns the file system roots.

boolean

mkdir()

Creates the directory named by this file, assuming its parents exist.

根据当前目录文件名创建目录文件,假定上级目录存在

boolean

mkdirs()

Creates the directory named by this file, creating missing parent directories if necessary.

创建缺失的上级目录

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值