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。

FileEntry[] getCachedChildren()

傳回項目的快取子項。

String getDate()

傳回項目的日期字串,由 ls 傳回。

String getFullEscapedPath()

傳回項目的完整逸出路徑。

String getFullPath()

傳回項目的完整路徑。

String getGroup()

傳回項目的群組擁有者,如 ls 傳回。

String getInfo()

傳回項目的額外資訊。

String getName()

傳回項目的名稱

String getOwner()

傳回項目的擁有者字串,如 ls 傳回。

FileListingService.FileEntry getParent()

傳回父項項目。

String[] getPathSegments()

以區隔清單的形式傳回路徑。

String getPermissions()

傳回項目的權限字串,如 ls 所傳回。

String getSize()

傳回項目的大小字串,如 ls 所傳回。

int getSizeValue()

傳回項目的大小。

String getTime()

傳回項目的時間字串,如 ls 所傳回。

int getType()

以 int 形式傳回項目類型,與其中一個 TYPE_(...) 常數相符

boolean isAppFileName()

如果檔案名稱是應用程式套件名稱,則傳回。

boolean isApplicationPackage()

如果項目是有效的應用程式套件,則傳回。

boolean isDirectory()

如果項目是資料夾或資料夾連結,則傳回 true。

boolean isRoot()

傳回項目是否為根目錄。

void setType(int type)

設定新類型。

受保護的方法

void fillPathBuilder(StringBuilder pathBuilder, boolean escapePath)

以遞迴方式將完整路徑填入 pathBuilder

void fillPathSegments(ArrayList<String> list)

以完整路徑遞迴填入區隔清單。

公用建構函式

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:這是否為根目錄。

公用方法

Escape 鍵

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

getParent

public FileListingService.FileEntry getParent ()

傳回上層項目。

傳回
FileListingService.FileEntry

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 形式傳回項目類型,與其中一個 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 (ArrayList<String> list)

以完整路徑遞迴填入區隔清單。

參數
list ArrayList:要填入的區隔清單。