FileListingService.FileEntry
public
static
final
class
FileListingService.FileEntry
extends Object
| java.lang.Object | |
| ↳ | com.android.ddmlib.FileListingService.FileEntry |
代表目錄中的項目。可以是檔案或目錄。
摘要
公用建構函式 | |
|---|---|
FileEntry(FileListingService.FileEntry parent, String name, int type, boolean isRoot)
建立新的檔案項目。 |
|
公用方法 | |
|---|---|
static
String
|
escape(String entryName)
傳回經過逸出處理的項目名稱。 |
FileListingService.FileEntry
|
findChild(String name)
傳回與名稱相符的子項 |
FileEntry[]
|
getCachedChildren()
傳回項目的快取子項。 |
String
|
getDate()
傳回項目的日期字串,與 |
String
|
getFullEscapedPath()
傳回項目的完整逸出路徑。 |
String
|
getFullPath()
傳回項目的完整路徑。 |
String
|
getGroup()
傳回項目的群組擁有者,如 |
String
|
getInfo()
傳回項目的額外資訊。 |
String
|
getName()
傳回項目的名稱 |
String
|
getOwner()
傳回項目擁有者字串,如 |
FileListingService.FileEntry
|
getParent()
傳回父項項目。 |
String[]
|
getPathSegments()
以區段清單形式傳回路徑。 |
String
|
getPermissions()
傳回項目權限字串,如 |
String
|
getSize()
傳回項目的尺寸字串,如 |
int
|
getSizeValue()
傳回項目的尺寸。 |
String
|
getTime()
傳回項目時間字串,如 |
int
|
getType()
以 int 形式傳回 Entry 類型,這會與 TYPE_(...) 常數之一相符 |
boolean
|
isAppFileName()
傳回檔案名稱是否為應用程式套件名稱。 |
boolean
|
isApplicationPackage()
如果項目是有效的應用程式套件,則傳回 true。 |
boolean
|
isDirectory()
傳回項目是否為資料夾或資料夾連結。 |
boolean
|
isRoot()
傳回項目是否為根目錄。 |
void
|
setType(int type)
設定新類型。 |
受保護的方法 | |
|---|---|
void
|
fillPathBuilder(StringBuilder pathBuilder, boolean escapePath)
Recursively fills the pathBuilder with the full path |
void
|
fillPathSegments(
以完整路徑遞迴填入區隔清單。 |
公用建構函式
FileEntry
public FileEntry (FileListingService.FileEntry parent, String name, int type, boolean isRoot)
建立新的檔案項目。
| 參數 | |
|---|---|
parent |
FileListingService.FileEntry:父項或空值 (如果項目是根項) |
name |
String:項目的名稱。 |
type |
int:項目類型。可為下列其中一個值:FileListingService.TYPE_FILE、FileListingService.TYPE_DIRECTORY、FileListingService.TYPE_OTHER。 |
isRoot |
boolean:是否為根目錄。 |
公用方法
逸出
public static String escape (String entryName)
傳回經過逸出的項目名稱版本。
| 傳回 | |
|---|---|
String |
|
findChild
public FileListingService.FileEntry findChild (String name)
傳回與名稱相符的子項 FileEntry。這項操作會使用快取的子項清單。
| 參數 | |
|---|---|
name |
String:要傳回的子項名稱。 |
| 傳回 | |
|---|---|
FileListingService.FileEntry |
與名稱相符的 FileEntry,或為空值。 |
getCachedChildren
public FileEntry[] getCachedChildren ()
傳回項目的快取子項。這會傳回透過呼叫 FileListingService.getChildren() 建立的快取。
| 傳回 | |
|---|---|
FileEntry[] |
|
getDate
public String getDate ()
傳回項目的日期字串,與 ls 傳回的字串相同。
| 傳回 | |
|---|---|
String |
|
getFullEscapedPath
public String getFullEscapedPath ()
傳回項目的完整逸出路徑。這個路徑可安全地用於殼層指令列。
| 傳回 | |
|---|---|
String |
以 FileListingService.FILE_SEPARATOR 做為分隔符的路徑字串 |
getFullPath
public String getFullPath ()
傳回項目的完整路徑。
| 傳回 | |
|---|---|
String |
以 FileListingService.FILE_SEPARATOR 做為分隔符的路徑字串。 |
getGroup
public String getGroup ()
傳回項目的群組擁有者,如 ls 傳回的結果。
| 傳回 | |
|---|---|
String |
|
getInfo
public String getInfo ()
傳回項目的額外資訊。
如果是連結,則會是連結的說明。
如果是應用程式 APK 檔案,則為套件管理員傳回的應用程式套件。
| 傳回 | |
|---|---|
String |
|
getName
public String getName ()
傳回項目的名稱
| 傳回 | |
|---|---|
String |
|
getOwner
public String getOwner ()
傳回項目擁有者字串,如 ls 傳回的字串。
| 傳回 | |
|---|---|
String |
|
getPathSegments
public String[] getPathSegments ()
以區段清單形式傳回路徑。
| 傳回 | |
|---|---|
String[] |
|
getPermissions
public String getPermissions ()
傳回項目權限字串,如 ls 傳回的字串。
| 傳回 | |
|---|---|
String |
|
getSize
public String getSize ()
傳回項目的大小字串,如 ls 傳回的字串。
| 傳回 | |
|---|---|
String |
|
getSizeValue
public int getSizeValue ()
傳回項目的尺寸。
| 傳回 | |
|---|---|
int |
|
getTime
public String getTime ()
傳回項目時間字串,如 ls 所傳回。
| 傳回 | |
|---|---|
String |
|
getType
public int getType ()
以 int 形式傳回 Entry 型別,這會與 TYPE_(...) 常數之一相符
| 傳回 | |
|---|---|
int |
|
isAppFileName
public boolean isAppFileName ()
傳回檔案名稱是否為應用程式套件名稱。
| 傳回 | |
|---|---|
boolean |
|
isApplicationPackage
public boolean isApplicationPackage ()
如果項目是有效的應用程式套件,則傳回。
| 傳回 | |
|---|---|
boolean |
|
isDirectory
public boolean isDirectory ()
如果項目是資料夾或資料夾連結,則傳回 true。
| 傳回 | |
|---|---|
boolean |
|
isRoot
public boolean isRoot ()
傳回項目是否為根目錄。
| 傳回 | |
|---|---|
boolean |
|
setType
public void setType (int type)
設定新類型。
| 參數 | |
|---|---|
type |
int |
受保護的方法
fillPathBuilder
protected void fillPathBuilder (StringBuilder pathBuilder,
boolean escapePath)以完整路徑遞迴填入 pathBuilder
| 參數 | |
|---|---|
pathBuilder |
StringBuilder:用於建立路徑的 StringBuilder。 |
escapePath |
boolean:路徑是否需要逸出,才能供殼層指令列使用。 |
fillPathSegments
protected void fillPathSegments (list)
以完整路徑遞迴填入區段清單。
| 參數 | |
|---|---|
list |
:要填入的區隔清單。 |