Class RegularFile

java.lang.Object
org.fedoraproject.xmvn.tools.install.File
org.fedoraproject.xmvn.tools.install.RegularFile

public class RegularFile extends File
A regular file created installed in target package.

The file can be installed either by coping an existing file (source file), or by writing provided contents.

Author:
Mikolaj Izdebski
  • Constructor Details

    • RegularFile

      public RegularFile(Path targetPath, Path sourcePath)
      Create a regular file object, which contents will be populated from a source file. Target file will have default access mode (0644).
      Parameters:
      targetPath - file path, relative to installation root
      sourcePath - path to source file which will be copied to target path
    • RegularFile

      public RegularFile(Path targetPath, byte[] content)
      Create a regular file object, which contents will be populated from a byte array. Target file will have default access mode (0644).
      Parameters:
      targetPath - file path, relative to installation root
      content - array of bytes used to populate target file contents with
    • RegularFile

      public RegularFile(Path targetPath, Supplier<byte[]> content)
      Create a regular file object, which contents will be populated from a byte array. Target file will have default access mode (0644).
      Parameters:
      targetPath - file path, relative to installation root
      content - provider of array of bytes used to populate target file contents with
    • RegularFile

      public RegularFile(Path targetPath, Path sourcePath, int accessMode)
      Create a regular file object, which contents will be populated from a source file. Target file will have specified access mode.
      Parameters:
      targetPath - file path, relative to installation root
      sourcePath - path to source file which will be copied to target path
      accessMode - Unix access mode of the file (must be an integer in range from 0 to 0777)
    • RegularFile

      public 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
      Parameters:
      targetPath - file path, relative to installation root
      content - array of bytes used to populate target file contents with
      accessMode - Unix access mode of the file (must be an integer in range from 0 to 0777)
    • RegularFile

      public RegularFile(Path targetPath, Supplier<byte[]> content, int accessMode)
      Create a regular file object, which contents will be populated from an input stream. Target file will have specified access mode
      Parameters:
      targetPath - file path, relative to installation root
      content - provider of array of bytes used to populate target file contents with
      accessMode - Unix access mode of the file (must be an integer in range from 0 to 0777)
  • Method Details

    • installContents

      protected void installContents(Path targetPath) throws IOException
      Description copied from class: File
      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.

      Specified by:
      installContents in class File
      Parameters:
      targetPath - absolute path to the target file
      Throws:
      IOException