Package com.android.builder.files
Class RelativeFile
java.lang.Object
com.android.builder.files.RelativeFile
Representation of a file with respect to a base directory. A
RelativeFile contains
information on the file, the base directory and the relative path from the base directory to
the file. The relative path is kept in OS independent form with sub directories separated by
slashes.
Neither the file nor the base need to exist. They are treated as abstract paths.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRelativeFile(File base, File file) Creates a new relative file.RelativeFile(File base, String relativePath) Creates a new relative file. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic RelativeFilefileInDirectory(String relativePath, File file) getBase()Obtains the base directory or jar.getFile()Returns the actual file from the directory.Obtains the OS independent path.getType()inthashCode()toString()
-
Field Details
-
type
-
-
Constructor Details
-
RelativeFile
Creates a new relative file.- Parameters:
base- the base directory.file- the file, must not be the same as the base directory and must be located insidebase
-
RelativeFile
Creates a new relative file.- Parameters:
base- the base jar.relativePath- the relative path to the file.
-
-
Method Details
-
fileInDirectory
-
getBase
Obtains the base directory or jar.Only applicable when
getType()==RelativeFile.Type.JAR- Returns:
- the base directory or jar as provided when created the object
-
getRelativePath
Obtains the OS independent path. The general contract of the normalized relative path is that by replacing the slashes by file separators in the relative path and appending it to the base directory's path, the resulting path is the file's path- Returns:
- the normalized path, separated by slashes; directories have a terminating slash
-
getType
-
getFile
Returns the actual file from the directory.Only applicable when
getType()==RelativeFile.Type.DIRECTORY- Returns:
-
hashCode
public int hashCode() -
equals
-
toString
-