Interface Resource


  • public interface Resource
    Resource item that abstracts from the actual type of underlying resource, such as:
    • A File.
    • A classpath resource.
    • An URL.
    • Method Detail

      • exists

        boolean exists()
        Check if this resource actually exists in physical form.
        Returns:
        true if the resource exists, false otherwise.
      • toFile

        File toFile()
        Return a File handle for this resource.
        Returns:
        The file associated to this resource.
      • getFilename

        String getFilename()
        Returns the filename of the resource.
        Returns:
        The filename.
      • getPath

        String getPath()
        Get full path of resource.
        Returns:
        Full path.
      • isDirectory

        boolean isDirectory()
        Check if this resource is a directory.
        Returns:
        true if the resource is a directory, false otherwise.
      • listResources

        Collection<Resource> listResources()
        Get all sub-resources: if the resource is not a directory, then this method should returns an empty list.
        Returns:
        Sub-resources.