Package com.microej.wear.services
Interface ExternalResourceService
-
public interface ExternalResourceServiceThis service allows Features to create and delete external resources.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classExternalResourceService.ImageFormatEnumerates supported image formats.static interfaceExternalResourceService.WriterRepresents a writer to an external resource.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ExternalResourceService.WritercreateExternalImage(String path, int size, ExternalResourceService.ImageFormat imageFormat)Creates an external image at the given path, converting it to the given format.ExternalResourceService.WritercreateExternalResource(String path, int size)Creates an external resource at the given path.booleandeleteExternalResource(String path)Deletes the external resource at the given path.StringgetExternalResourcePath(String path)Returns the path to an external resource.
-
-
-
Method Detail
-
createExternalResource
ExternalResourceService.Writer createExternalResource(String path, int size) throws IOException
Creates an external resource at the given path.- Parameters:
path- the path of the external resource (relative to the Module directory).size- the size of the data to be written to the external resource.- Returns:
- a writer to the external resource.
- Throws:
IllegalArgumentException- if the path does not start with a "/".IllegalArgumentException- if the size is negative.IOException- if an external resource with the same path already exists.IOException- if a writer to the same path is already opened.IOException- if there is not enough memory in the external resource location to allocate the resource.
-
createExternalImage
ExternalResourceService.Writer createExternalImage(String path, int size, ExternalResourceService.ImageFormat imageFormat) throws IOException
Creates an external image at the given path, converting it to the given format.- Parameters:
path- the path of the external resource (relative to the Module directory).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:
IllegalArgumentException- if the path does not start with a "/".IllegalArgumentException- if the size is negative.IOException- if an external resource with the same path already exists.IOException- if a writer to the same path is already opened.IOException- if there is not enough memory in the external resource location to allocate the resource.
-
deleteExternalResource
boolean deleteExternalResource(String path) throws IOException
Deletes the external resource at the given path.- Parameters:
path- the path of the external resource (relative to the Module directory).- Returns:
trueif the resource was successfully deleted,falseif no resource exists at the given path.- Throws:
IllegalArgumentException- if the path does not start with a "/".IOException- if an error occurs while deleting the resource.IOException- if a writer to the resource is currently open.
-
-