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(java.lang.String path, int size, ExternalResourceService.ImageFormat imageFormat)Creates an external image at the given path, converting it to the given format.ExternalResourceService.WritercreateExternalResource(java.lang.String path, int size)Creates an external resource at the given path.booleandeleteExternalResource(java.lang.String path)Deletes the external resource at the given path.
-
-
-
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.IOExceptionDeletes the external resource at the given path.- Parameters:
path- the path of the external resource.- Returns:
trueif the resource was successfully deleted,falseif 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.
-
-