对于Android 2.3来说原始Sun公司的java.io.File包中的内容也有了改进,File类在API Level为9时多出了很多新特性,比较实用的有:
public long getFreeSpace () 返回这个分区包含这个路径的剩余空间,如果返回0则表示不存在,下面为SDK原文
Returns the number of free bytes on the partition containing this path. Returns 0 if this path does not exist. Note that this is likely to be an optimistic over-estimate and should not be taken as a guarantee your application can actually write this many bytes
public long getTotalSpace () 返回这个分区包含这个路径的总共字节,如果返回0则表示不存在,下面为SDK原文
Returns the total size in bytes of the partition containing this path. Returns 0 if this path does not exist
同时还有一些和权限相关的API,感兴趣的网友可以在Android 2.3的SDK文档中找到,详细如下
public boolean setExecutable (boolean executable)
public boolean setReadable (boolean readable)
public boolean setWritable (boolean writable, boolean ownerOnly)
RSS