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()

以整数形式返回条目类型,该整数将与某个 TYPE_(...) 常量匹配

boolean isAppFileName()

返回文件名是否为应用软件包名称。

boolean isApplicationPackage()

返回相应条目是否为有效的应用软件包。

boolean isDirectory()

如果条目是文件夹或指向文件夹的链接,则返回 true。

boolean isRoot()

返回相应条目是否为根条目。

void setType(int type)

设置新类型。

受保护的方法

void fillPathBuilder(StringBuilder pathBuilder, boolean escapePath)

以递归方式使用完整路径填充 pathBuilder

void fillPathSegments( list)

以完整路径递归填充段列表。

公共构造函数

FileEntry

public FileEntry (FileListingService.FileEntry parent, 
                String name, 
                int type, 
                boolean isRoot)

创建新的文件条目。

参数
parent FileListingService.FileEntry:父条目;如果条目是根条目,则为 null

name String:条目的名称。

type int:条目类型。可以是以下各项之一:FileListingService.TYPE_FILEFileListingService.TYPE_DIRECTORYFileListingService.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 或 null。

getCachedChildren

public FileEntry[] getCachedChildren ()

返回条目的缓存子项。此方法会返回通过调用 FileListingService.getChildren() 创建的缓存。

返回
FileEntry[]

getDate

public String getDate ()

返回条目的日期字符串,与 ls 返回的字符串相同。

返回
String

getFullEscapedPath

public String getFullEscapedPath ()

返回条目的完全转义路径。此路径可在 shell 命令行中安全使用。

返回
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 ()

以整数形式返回 Entry 类型,该整数将与某个 TYPE_(...) 常量匹配

返回
int

isAppFileName

public boolean isAppFileName ()

返回文件名是否为应用软件包名称。

返回
boolean

isApplicationPackage

public boolean isApplicationPackage ()

返回相应条目是否为有效的应用软件包。

返回
boolean

isDirectory

public boolean isDirectory ()

如果条目是文件夹或指向文件夹的链接,则返回。

返回
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:路径是否需要转义以供 shell 命令行使用。

fillPathSegments

protected void fillPathSegments ( list)

以递归方式使用完整路径填充段列表。

参数
list :要填充的细分列表。