Class BuiltFileResource

  • All Implemented Interfaces:
    Resource

    public class BuiltFileResource
    extends java.lang.Object
    implements Resource
    Represents an artifact built by a PackagerResolver.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BUILT_ARTIFACT_PATTERN
      Where the build file should put built artifacts (relative to the build directory).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Resource clone​(java.lang.String name)
      Clones this resource with a new resource with a different name
      boolean exists()
      Determine if the resource is available.
      long getContentLength()
      Get the resource size
      java.io.File getFile()  
      long getLastModified()
      Get the date the resource was last modified
      java.lang.String getName()
      Get the name of the resource.
      boolean isLocal()
      Is this resource local to this host, i.e.
      java.io.InputStream openStream()
      Opens a stream on this resource
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • BUILT_ARTIFACT_PATTERN

        public static final java.lang.String BUILT_ARTIFACT_PATTERN
        Where the build file should put built artifacts (relative to the build directory). Value is: "artifacts/[type]s/[artifact].[ext]"
        See Also:
        Constant Field Values
    • Constructor Detail

      • BuiltFileResource

        public BuiltFileResource​(java.io.File file)
      • BuiltFileResource

        public BuiltFileResource​(java.io.File dir,
                                 Artifact artifact)
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: Resource
        Get the name of the resource.
        Specified by:
        getName in interface Resource
        Returns:
        the repository's assigned resource name/identifier.
      • clone

        public Resource clone​(java.lang.String name)
        Description copied from interface: Resource
        Clones this resource with a new resource with a different name
        Specified by:
        clone in interface Resource
        Parameters:
        name - the name of the clone
        Returns:
        the cloned resource
      • getLastModified

        public long getLastModified()
        Description copied from interface: Resource
        Get the date the resource was last modified
        Specified by:
        getLastModified in interface Resource
        Returns:
        A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs.
      • getContentLength

        public long getContentLength()
        Description copied from interface: Resource
        Get the resource size
        Specified by:
        getContentLength in interface Resource
        Returns:
        a long value representing the size of the resource in bytes.
      • exists

        public boolean exists()
        Description copied from interface: Resource
        Determine if the resource is available. Note that this method only checks for availability, not for actual existence.
        Specified by:
        exists in interface Resource
        Returns:
        boolean value indicating if the resource is available.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getFile

        public java.io.File getFile()
      • isLocal

        public boolean isLocal()
        Description copied from interface: Resource
        Is this resource local to this host, i.e. is it on the file system?
        Specified by:
        isLocal in interface Resource
        Returns:
        boolean value indicating if the resource is local.
      • openStream

        public java.io.InputStream openStream()
                                       throws java.io.IOException
        Description copied from interface: Resource
        Opens a stream on this resource
        Specified by:
        openStream in interface Resource
        Returns:
        the opened input stream
        Throws:
        java.io.IOException - if something goes wrong