Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> Android開發 >> 中級開發 >> Android 2.3中的java.io.File類新增功能

Android 2.3中的java.io.File類新增功能

編輯:中級開發

對於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)

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved