Class UrlResource

  • All Implemented Interfaces:
    Resource

    public class UrlResource
    extends Object
    implements Resource
    Resource implementation for URL resources.
    Since:
    4.0.0
    Author:
    Dmytro Nosan
    • Constructor Detail

      • UrlResource

        public UrlResource​(URL url)
        Constructs a new UrlResource with the specified URL.
        Parameters:
        url - the URL
    • Method Detail

      • getFileName

        public Optional<String> getFileName()
        Description copied from interface: Resource
        Gets the file name of this resource.
        Specified by:
        getFileName in interface Resource
        Returns:
        the name of this Resource.
      • exists

        public boolean exists()
        Description copied from interface: Resource
        Tests whether a resource exists.
        Specified by:
        exists in interface Resource
        Returns:
        true if the resource exists
      • isWritable

        public boolean isWritable()
        Description copied from interface: Resource
        Tests whether a resource is writable.
        Specified by:
        isWritable in interface Resource
        Returns:
        true if the resource exists and is writable
      • isReadable

        public boolean isReadable()
        Description copied from interface: Resource
        Tests whether a resource is readable.
        Specified by:
        isReadable in interface Resource
        Returns:
        true if the resource exists and is readable
      • toURL

        public URL toURL()
        Description copied from interface: Resource
        Gets a URL to the underlying resource.
        Specified by:
        toURL in interface Resource
        Returns:
        the URL to the resource
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object