public class RegularFile extends File
The file can be installed either by coping an existing file (source file), or by writing provided contents.
Constructor and Description |
---|
RegularFile(Path targetPath,
byte[] content)
Create a regular file object, which contents will be populated from a byte array.
|
RegularFile(Path targetPath,
byte[] content,
int accessMode)
Create a regular file object, which contents will be populated from a byte array.Target file will have specified
access mode
|
RegularFile(Path targetPath,
Path sourcePath)
Create a regular file object, which contents will be populated from a source file.
|
RegularFile(Path targetPath,
Path sourcePath,
int accessMode)
Create a regular file object, which contents will be populated from a source file.
|
Modifier and Type | Method and Description |
---|---|
protected void |
installContents(Path targetPath)
Install the file into specified location.
|
equals, getAccessMode, getDescriptor, getDescriptorExtra, getTargetPath, hashCode, install
public RegularFile(Path targetPath, Path sourcePath)
targetPath
- file path, relative to installation rootsourcePath
- path to source file which will be copied to target pathpublic RegularFile(Path targetPath, byte[] content)
targetPath
- file path, relative to installation rootcontent
- array of bytes using to populate target file contents withpublic RegularFile(Path targetPath, Path sourcePath, int accessMode)
targetPath
- file path, relative to installation rootsourcePath
- path to source file which will be copied to target pathaccessMode
- Unix access mode of the file (must be an integer in range from 0 to 0777)public RegularFile(Path targetPath, byte[] content, int accessMode)
targetPath
- file path, relative to installation rootcontent
- array of bytes using to populate target file contents withaccessMode
- Unix access mode of the file (must be an integer in range from 0 to 0777)protected void installContents(Path targetPath) throws IOException
File
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.
installContents
in class File
targetPath
- absolute path to the target fileIOException
Copyright © 2012–2015 Red Hat, Inc.. All rights reserved.