public abstract class File extends Object
A file does not necessarily mean a regular file, it could be for example a directory or a device file.
Constructor and Description |
---|
File(Path targetPath)
Create a file object with specified path and default access mode of 0644.
|
File(Path targetPath,
int accessMode)
Create a file object with specified path and access mode.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object rhs) |
int |
getAccessMode()
Get Unix access mode for this file.
|
String |
getDescriptor()
Get descriptor string for given file.
|
protected String |
getDescriptorExtra()
Get additional file attributes to be added to file descriptor.
|
Path |
getTargetPath()
Return path to target file.
|
int |
hashCode() |
void |
install(Path installRoot)
Install file into specified root directory.
|
protected abstract void |
installContents(Path targetAbsolutePath)
Install the file into specified location.
|
public File(Path targetPath)
targetPath
- file path, relative to installation rootpublic File(Path targetPath, int accessMode)
targetPath
- file path, relative to installation rootaccessMode
- Unix access mode of the file (must be an integer in range from 0 to 0777)protected abstract void installContents(Path targetAbsolutePath) throws IOException
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.
targetAbsolutePath
- absolute path to the target fileIOException
protected String getDescriptorExtra()
By default there are no extra attributes, but subclasses can override this method and specify it.
null
)public Path getTargetPath()
null
)public int getAccessMode()
public void install(Path installRoot) throws IOException
installRoot
- IOException
public String getDescriptor()
Descriptor is a line containing file path and some attributes. In other words, descriptor is a single line from
.mfiles
describing the file.
Copyright © 2012-2016 Red Hat, Inc.. All Rights Reserved.