Class File
java.lang.Object
org.fedoraproject.xmvn.tools.install.File
- Direct Known Subclasses:
Directory, RegularFile, SymbolicLink
An abstract class denoting a file entry in a package with all relevant attributes.
A file does not necessarily mean a regular file, it could be for example a directory or a device file.
- Author:
- Mikolaj Izdebski
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintGet Unix access mode for this file.Get descriptor string for given file.protected StringGet additional file attributes to be added to file descriptor.Return path to target file.inthashCode()voidInstall file into specified root directory.protected abstract voidinstallContents(Path targetAbsolutePath) Install the file into specified location.
-
Constructor Details
-
File
Create a file object with specified path and default access mode of 0644.- Parameters:
targetPath- file path, relative to installation root
-
File
Create a file object with specified path and access mode.- Parameters:
targetPath- file path, relative to installation rootaccessMode- Unix access mode of the file (must be an integer in range from 0 to 0777)
-
-
Method Details
-
installContents
Install the file into specified location.Implementations of this method can assume that all parent directory of target file already exists. Access mode of target file doesn't have to be set as it will be manipulated with other means.
- Parameters:
targetAbsolutePath- absolute path to the target file- Throws:
IOException
-
getDescriptorExtra
Get additional file attributes to be added to file descriptor.By default there are no extra attributes, but subclasses can override this method and specify it.
- Returns:
- extra descriptor data (can be
null)
-
getTargetPath
Return path to target file. Returned path is always relative to buildroot (never absolute).- Returns:
- file target path (never
null)
-
getAccessMode
public int getAccessMode()Get Unix access mode for this file.- Returns:
- Unix access mode (an integer in range from 0 to 0777)
-
install
Install file into specified root directory.- Parameters:
installRoot-- Throws:
IOException
-
getDescriptor
Get descriptor string for given file.Descriptor is a line containing file path and some attributes. In other words, descriptor is a single line from
.mfilesdescribing the file.- Returns:
- descriptor string
-
hashCode
-
equals
-