FileListingService.FileEntry

public static final class FileListingService.FileEntry
extends Object

java.lang.Object
   ↳ com.android.ddmlib.FileListingService.FileEntry


Represents an entry in a directory. This can be a file or a directory.

Summary

Public constructors

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

Creates a new file entry.

Public methods

static String escape(String entryName)

Returns an escaped version of the entry name.

FileListingService.FileEntry findChild(String name)

Returns the child FileEntry matching the name.

FileEntry[] getCachedChildren()

Returns the cached children of the entry.

String getDate()

Returns the date string of the entry, as returned by ls.

String getFullEscapedPath()

Return the fully escaped path of the entry.

String getFullPath()

Return the full path of the entry.

String getGroup()

Returns the group owner of the entry, as returned by ls.

String getInfo()

Returns the extra info for the entry.

String getName()

Returns the name of the entry

String getOwner()

Returns the owner string of the entry, as returned by ls.

FileListingService.FileEntry getParent()

Returns the parent entry.

String[] getPathSegments()

Returns the path as a list of segments.

String getPermissions()

Returns the permission string of the entry, as returned by ls.

String getSize()

Returns the size string of the entry, as returned by ls.

int getSizeValue()

Returns the size of the entry.

String getTime()

Returns the time string of the entry, as returned by ls.

int getType()

Returns the Entry type as an int, which will match one of the TYPE_(...) constants

boolean isAppFileName()

Returns if the file name is an application package name.

boolean isApplicationPackage()

Returns if the entry is a valid application package.

boolean isDirectory()

Returns if the entry is a folder or a link to a folder.

boolean isRoot()

Returns whether the entry is the root.

void setType(int type)

Sets a new type.

Protected methods

void fillPathBuilder(StringBuilder pathBuilder, boolean escapePath)

Recursively fills the pathBuilder with the full path

void fillPathSegments( list)

Recursively fills the segment list with the full path.

Public constructors

FileEntry

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

Creates a new file entry.

Parameters
parent FileListingService.FileEntry: parent entry or null if entry is root

name String: name of the entry.

type int: entry type. Can be one of the following: FileListingService.TYPE_FILE, FileListingService.TYPE_DIRECTORY, FileListingService.TYPE_OTHER.

isRoot boolean: whether this is the root dir or not.

Public methods

escape

public static String escape (String entryName)

Returns an escaped version of the entry name.

Returns
String

findChild

public FileListingService.FileEntry findChild (String name)

Returns the child FileEntry matching the name. This uses the cached children list.

Parameters
name String: the name of the child to return.

Returns
FileListingService.FileEntry the FileEntry matching the name or null.

getCachedChildren

public FileEntry[] getCachedChildren ()

Returns the cached children of the entry. This returns the cache created from calling FileListingService.getChildren().

Returns
FileEntry[]

getDate

public String getDate ()

Returns the date string of the entry, as returned by ls.

Returns
String

getFullEscapedPath

public String getFullEscapedPath ()

Return the fully escaped path of the entry. This path is safe to use in a shell command line.

Returns
String a path string using FileListingService.FILE_SEPARATOR as separator

getFullPath

public String getFullPath ()

Return the full path of the entry.

Returns
String a path string using FileListingService.FILE_SEPARATOR as separator.

getGroup

public String getGroup ()

Returns the group owner of the entry, as returned by ls.

Returns
String

getInfo

public String getInfo ()

Returns the extra info for the entry.

For a link, it will be a description of the link.

For an application apk file it will be the application package as returned by the Package Manager.

Returns
String

getName

public String getName ()

Returns the name of the entry

Returns
String

getOwner

public String getOwner ()

Returns the owner string of the entry, as returned by ls.

Returns
String

getParent

public FileListingService.FileEntry getParent ()

Returns the parent entry.

Returns
FileListingService.FileEntry

getPathSegments

public String[] getPathSegments ()

Returns the path as a list of segments.

Returns
String[]

getPermissions

public String getPermissions ()

Returns the permission string of the entry, as returned by ls.

Returns
String

getSize

public String getSize ()

Returns the size string of the entry, as returned by ls.

Returns
String

getSizeValue

public int getSizeValue ()

Returns the size of the entry.

Returns
int

getTime

public String getTime ()

Returns the time string of the entry, as returned by ls.

Returns
String

getType

public int getType ()

Returns the Entry type as an int, which will match one of the TYPE_(...) constants

Returns
int

isAppFileName

public boolean isAppFileName ()

Returns if the file name is an application package name.

Returns
boolean

isApplicationPackage

public boolean isApplicationPackage ()

Returns if the entry is a valid application package.

Returns
boolean

isDirectory

public boolean isDirectory ()

Returns if the entry is a folder or a link to a folder.

Returns
boolean

isRoot

public boolean isRoot ()

Returns whether the entry is the root.

Returns
boolean

setType

public void setType (int type)

Sets a new type.

Parameters
type int

Protected methods

fillPathBuilder

protected void fillPathBuilder (StringBuilder pathBuilder, 
                boolean escapePath)

Recursively fills the pathBuilder with the full path

Parameters
pathBuilder StringBuilder: a StringBuilder used to create the path.

escapePath boolean: Whether the path need to be escaped for consumption by a shell command line.

fillPathSegments

protected void fillPathSegments ( list)

Recursively fills the segment list with the full path.

Parameters
list : The list of segments to fill.