Class ClassPathFile

    • Constructor Detail

      • ClassPathFile

        public ClassPathFile​(java.lang.String path)
        Create a new ClassPathFile instance.
        Parameters:
        path - the path of the resource
      • ClassPathFile

        public ClassPathFile​(java.lang.ClassLoader classLoader,
                             java.lang.String path)
        Create a new ClassPathFile instance.
        Parameters:
        classLoader - a ClassLoader or null to use the default
        path - the path of the resource
      • ClassPathFile

        public ClassPathFile​(java.lang.Class<?> sourceClass,
                             java.lang.String path)
        Create a new ClassPathFile instance.
        Parameters:
        sourceClass - the source class used to load the resource
        path - the path of the resource (relative to the sourceClass)
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: Resource
        Returns the name of the resource. This name does not include any path element. Root folders will have an empty string name.
        Returns:
        the name of the resource, for example "file.txt"
      • toStringRelativeTo

        public java.lang.String toStringRelativeTo​(Folder source)
        Description copied from interface: Resource
        Returns the the complete name of this resource (including path elements) relative to the specified source folder. The source must be a parent (or grandparent etc) of this resource. If the source is this folder an empty String is returned. The returned value does not include any leading slash, for example: '/a/b/c.txt' relative to '/a/' will return 'b/c.txt'.
        Parameters:
        source - the source folder
        Returns:
        the name
        See Also:
        Resource.toString(), Resource.toStringRelativeTo(Folder)
      • isRelativeTo

        public boolean isRelativeTo​(Folder folder)
        Returns:
        true if the given param folder is relative to comprising folder object, else return false
      • isModifiedAfter

        public boolean isModifiedAfter​(long n)
      • isModifiedAfter

        public boolean isModifiedAfter​(Resource resource)
      • isModifiedBefore

        public boolean isModifiedBefore​(long n)
      • isModifiedBefore

        public boolean isModifiedBefore​(Resource resource)
      • copyToIfNewer

        public File copyToIfNewer​(Folder folder)
        Description copied from interface: File
        RCopy this file to the specified folder if this file is newer than the destination.
        Parameters:
        folder - the folder to copy the file to
        Returns:
        a new resource (the current resource will no longer exist
      • getInputStream

        protected java.io.InputStream getInputStream()
        Description copied from class: AbstractReadOnlyFile
        Return the input stream for the contents of the File or null if the file does not exist.
        Specified by:
        getInputStream in class AbstractReadOnlyFile
        Returns:
        the InputStream or null