Interface ExternalResourceService


  • public interface ExternalResourceService
    This service allows Features to create and delete external resources.
    • Method Detail

      • createExternalResource

        ExternalResourceService.Writer createExternalResource​(java.lang.String path,
                                                              int size)
                                                       throws java.io.IOException
        Creates an external resource at the given path.
        Parameters:
        path - the path of the external resource.
        size - the size of the data to be written to the external resource.
        Returns:
        a writer to the external resource.
        Throws:
        java.lang.IllegalArgumentException - if the path does not start with a "/".
        java.lang.IllegalArgumentException - if the size is negative.
        java.io.IOException - if an external resource with the same path already exists.
        java.io.IOException - if a writer to the same path is already opened.
        java.io.IOException - if there is not enough memory in the external resource location to allocate the resource.
      • createExternalImage

        ExternalResourceService.Writer createExternalImage​(java.lang.String path,
                                                           int size,
                                                           ExternalResourceService.ImageFormat imageFormat)
                                                    throws java.io.IOException
        Creates an external image at the given path, converting it to the given format.
        Parameters:
        path - the path of the external resource.
        size - the size of the data to be written to the external resource.
        imageFormat - the format to convert the image to.
        Returns:
        a writer to the external resource.
        Throws:
        java.lang.IllegalArgumentException - if the path does not start with a "/".
        java.lang.IllegalArgumentException - if the size is negative.
        java.io.IOException - if an external resource with the same path already exists.
        java.io.IOException - if a writer to the same path is already opened.
        java.io.IOException - if there is not enough memory in the external resource location to allocate the resource.
      • deleteExternalResource

        boolean deleteExternalResource​(java.lang.String path)
                                throws java.io.IOException
        Deletes the external resource at the given path.
        Parameters:
        path - the path of the external resource.
        Returns:
        true if the resource was successfully deleted, false if no resource exists at the given path.
        Throws:
        java.lang.IllegalArgumentException - if the path does not start with a "/".
        java.io.IOException - if an error occurs while deleting the resource.
        java.io.IOException - if a writer to the resource is currently open.