Module org.update4j
Package org.update4j

Class FileMetadata.Reference

Object
Reference
Enclosing class:
FileMetadata

public static class FileMetadata.Reference
extends Object
A reference to a file can be used by the Builder API to read its metadata. You can construct a reference by using either FileMetadata.readFrom(Path) or FileMetadata.streamDirectory(Path).
Author:
Mordechai Meisels
  • Method Details

    • getSource

      public Path getSource()
      Returns the real file location that this instance refers to.
      Returns:
      The real file location that this instance refers to.
    • uri

      public FileMetadata.Reference uri​(URI uri)
      Set the download URI for this file. This might be an absolute uri, relative to the base uri, or — if missing — inferred from the path.

      When inferring from the path it will use the complete path structure if — and only if — the path is relative to the base path. Otherwise it will only use the last part (i.e. the "filename").

      Returns:
      This instance for chaining.
    • uri

      public FileMetadata.Reference uri​(String uri)
      Set the download URI for this file. This might be an absolute uri, relative to the base uri, or — if missing — inferred from the path.

      When inferring from the path it will use the complete path structure if — and only if — the path is relative to the base path. Otherwise it will only use the last part (i.e. the "filename").

      This field may contain placeholders.

      Returns:
      This instance for chaining.
    • getUri

      public String getUri()
      Returns the URI passed in uri(String) or null if non.
      Returns:
      The URI passed in uri(String) or null.
    • path

      public FileMetadata.Reference path​(Path path)
      Sets the local path for this file. This might be an absolute path, relative to the base path, or — if missing — inferred from the uri attribute, if both are missing, the source returned by getSource().

      When inferring from the uri it will use the complete path structure if — and only if — the uri is relative to the base uri. Otherwise it will only use the last part (i.e. the "filename").

      Returns:
      This instance for chaining.
    • path

      public FileMetadata.Reference path​(String path)
      Sets the local path for this file. This might be an absolute path, relative to the base path, or — if missing — inferred from the uri attribute, if both are missing, the source returned by getSource().

      When inferring from the uri it will use the complete path structure if — and only if — the uri is relative to the base uri. Otherwise it will only use the last part (i.e. the "filename").

      Returns:
      This instance for chaining.
    • os

      public FileMetadata.Reference os​(OS os)
      Sets the os of this file to exclude it from other operating systems when updating and launching.
      Parameters:
      os - The operating system to associate this file with.
      Returns:
      This instance for chaining.
    • osFromFilename

      public FileMetadata.Reference osFromFilename()
      Sets the os by parsing the filename. The os is detected if it matches this pattern:
       filename-os.extension
       
      where os can be win, mac or linux.

      Examples include:

       appicon-win.ico
       appicon-mac.icns
       appicon-linux.png
       
       javafx-base-11.0.1-win.jar
       javafx-base-11.0.1-mac.jar
       javafx-base-11.0.1-linux.jar
       

      If a match is not found, the old value will not be changed.

      Returns:
      This instance for chaining.
    • getOs

      public OS getOs()
      Returns the os passed in os(OS) or null if non.
      Returns:
      The os passed in os(OS) or null.
    • classpath

      public FileMetadata.Reference classpath​(boolean cp)
    • classpath

      public FileMetadata.Reference classpath()
    • isClasspath

      public boolean isClasspath()
    • modulepath

      public FileMetadata.Reference modulepath​(boolean mp)
    • modulepath

      public FileMetadata.Reference modulepath()
    • isModulepath

      public boolean isModulepath()
    • comment

      public FileMetadata.Reference comment​(String c)
    • getComment

      public String getComment()
    • ignoreBootConflict

      public FileMetadata.Reference ignoreBootConflict​(boolean b)
    • ignoreBootConflict

      public FileMetadata.Reference ignoreBootConflict()
    • isIgnoreBootConflict

      public boolean isIgnoreBootConflict()
    • exports

      public FileMetadata.Reference exports​(String pkg, String targetModule)
    • exports

      public FileMetadata.Reference exports​(Collection<AddPackage> exports)
    • getAddExports

      public List<AddPackage> getAddExports()
    • opens

      public FileMetadata.Reference opens​(String pkg, String targetModule)
    • opens

      public FileMetadata.Reference opens​(Collection<AddPackage> opens)
    • getAddOpens

      public List<AddPackage> getAddOpens()
    • reads

      public FileMetadata.Reference reads​(String module)
    • reads

      public FileMetadata.Reference reads​(Collection<String> reads)
    • getAddReads

      public List<String> getAddReads()
    • matchAndReplace

      public FileMetadata.Reference matchAndReplace​(PlaceholderMatchType matcher)
    • getMatchType

      public PlaceholderMatchType getMatchType()
    • getSize

      public long getSize() throws IOException
      Throws:
      IOException
    • getChecksum

      public long getChecksum() throws IOException
      Throws:
      IOException
    • getSignature

      public byte[] getSignature​(PrivateKey key) throws IOException
      Throws:
      IOException