public abstract class File
extends java.lang.Object
A file does not necessarily mean a regular file, it could be for example a directory or a device file.
Modifier and Type | Field and Description |
---|---|
(package private) static int |
DEFAULT_MODE |
(package private) static int |
DIRECTORY_MODE |
(package private) static int |
MAX_MODE |
Constructor and Description |
---|
File(java.nio.file.Path targetPath)
Create a file object with specified path and default access mode of 0644.
|
File(java.nio.file.Path targetPath,
int accessMode)
Create a file object with specified path and access mode.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object rhs) |
int |
getAccessMode()
Get Unix access mode for this file.
|
java.lang.String |
getDescriptor()
Get descriptor string for given file.
|
protected java.lang.String |
getDescriptorExtra()
Get additional file attributes to be added to file descriptor.
|
java.nio.file.Path |
getTargetPath()
Return path to target file.
|
int |
hashCode() |
void |
install(java.nio.file.Path installRoot)
Install file into specified root directory.
|
protected abstract void |
installContents(java.nio.file.Path targetAbsolutePath)
Install the file into specified location.
|
static final int DEFAULT_MODE
static final int DIRECTORY_MODE
static final int MAX_MODE
public File(java.nio.file.Path targetPath)
targetPath
- file path, relative to installation rootpublic File(java.nio.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(java.nio.file.Path targetAbsolutePath) throws java.io.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 filejava.io.IOException
protected java.lang.String getDescriptorExtra()
By default there are no extra attributes, but subclasses can override this method and specify it.
null
)public java.nio.file.Path getTargetPath()
null
)public int getAccessMode()
public void install(java.nio.file.Path installRoot) throws java.io.IOException
installRoot
- java.io.IOException
public java.lang.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.
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object rhs)
equals
in class java.lang.Object
Copyright © 2012–2017 Red Hat, Inc.. All rights reserved.