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