Class URLResource

    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • baseName

        public String baseName()
        Description copied from interface: Resource
        Gets the name (file name or directory name) of this resource.
        Specified by:
        baseName in interface Resource
        Overrides:
        baseName in class BaseResource
        Returns:
        The name of the file or directory
      • asURL

        public Optional<URL> asURL()
        Description copied from interface: Resource
        Gets the resource as a URL.
        Returns:
        A URL representing the resource.
      • getChild

        public Resource getChild​(String relativePath)
        Description copied from interface: Resource

        Creates a new Resource that is relative to this resource.

        Parameters:
        relativePath - The relative path for the new resource.
        Returns:
        A new resource that is relative to this resource.
      • getParent

        public Resource getParent()
        Description copied from interface: Resource
        Gets parent.
        Returns:
        The parent resource (directory for file, parent directory for a directory)
      • append

        public Resource append​(String content)
                        throws IOException
        Description copied from interface: Resource

        Appends the given string content to the resource.

        Parameters:
        content - The content to append
        Returns:
        the resource
        Throws:
        IOException - the io exception
      • append

        public Resource append​(byte[] byteArray)
                        throws IOException
        Description copied from interface: Resource

        Appends the given byte array content to the resource.

        Parameters:
        byteArray - The content to append
        Returns:
        the resource
        Throws:
        IOException - the io exception
      • exists

        public boolean exists()
        Description copied from interface: Resource
        Exists boolean.
        Returns:
        True if the resource exists, False if the resource does not exist.
      • readLines

        public List<String> readLines()
                               throws IOException
        Description copied from interface: Resource
        Reads the complete resource in as text breaking it into lines based on the newline character
        Returns:
        A list of string representing the contents of the file.
        Throws:
        IOException - the io exception
      • lines

        public MStream<String> lines()
                              throws IOException
        Description copied from interface: Resource
        Creates an MStream over the lines in the resource.
        Returns:
        the stream of lines
        Throws:
        IOException - Something went wrong reading from the resource
      • getUserAgent

        public String getUserAgent()
        Returns:
        The user agent string to pass along to the web server
      • setUserAgent

        public void setUserAgent​(String userAgent)
        Sets The user agent string to pass along to the web server
        Parameters:
        userAgent - the user agent
      • getConnectionTimeOut

        public int getConnectionTimeOut()
        Returns:
        the amount of time to wait in connecting to the host before giving up
      • setConnectionTimeOut

        public void setConnectionTimeOut​(int connectionTimeOut)
        Sets the amount of time to wait in connecting to the host before giving up
        Parameters:
        connectionTimeOut - The connectionTimeOut