Interface Resource

    • Method Detail

      • getResourceName

        java.lang.String getResourceName()
        Get the name of this Resource.
        Returns:
        Relative file path given to PlanFiles.
      • asBytes

        byte[] asBytes()
                throws java.io.IOException
        Throws:
        java.io.IOException
      • asInputStream

        java.io.InputStream asInputStream()
                                   throws java.io.IOException
        Get the resource as an InputStream.
        Returns:
        InputStream of the resource, not closed automatically.
        Throws:
        java.io.IOException - If the resource is unavailable.
      • asLines

        java.util.List<java.lang.String> asLines()
                                          throws java.io.IOException
        Get the resource as lines.
        Returns:
        Lines of the resource file.
        Throws:
        java.io.IOException - If the resource is unavailable.
      • asString

        java.lang.String asString()
                           throws java.io.IOException
        Get the resource as a String with each line separated by CRLF newline characters \r\n.
        Returns:
        Flat string with each line separated by \r\n.
        Throws:
        java.io.IOException - If the resource is unavailable.
      • asWebResource

        default WebResource asWebResource()
        Map to a WebResource used by ResourceService APIs.
        Returns:
        The resource
        Throws:
        java.io.UncheckedIOException - if fails to read the file.
      • isTextResource

        static boolean isTextResource​(java.lang.String resourceName)
        Check if a resource is a text based file.
        Parameters:
        resourceName - Name of the resource
        Returns:
        true if the resource is text based.