Package com.microej.wear.services
Interface ExternalResourceService.Writer
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- Enclosing interface:
- ExternalResourceService
public static interface ExternalResourceService.Writer extends java.io.Closeable
Represents a writer to an external resource.A conversion step can be applied when writing or saving the external resource. For example, images can be converted into a specific format before they are stored, depending on how the user will use that resource in the application.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes this writer and clears all uncommitted native resources.void
commit()
Flushes all written data and finalizes the resource.void
write(byte[] src, int srcOffset, int length, int destOffset)
Writes the given data to the external resource.
-
-
-
Method Detail
-
write
void write(byte[] src, int srcOffset, int length, int destOffset) throws java.io.IOException
Writes the given data to the external resource.- Parameters:
src
- the source array containing the data to write to the external resource.srcOffset
- the offset in the source array of the first byte to write.length
- the number of bytes to write.destOffset
- the offset in the destination (i.e., external resource) at which to write the data.- Throws:
java.lang.IndexOutOfBoundsException
- if the given srcOffset or the given length is out of the bounds of the source array.java.lang.IndexOutOfBoundsException
- if the given destOffset or the given length is out of the bounds of the destination.java.lang.IllegalStateException
- if this writer is closed.java.io.IOException
- if an error occurs while writing to the resource.java.io.IOException
- if an error occurs during the conversion phase.
-
commit
void commit() throws java.io.IOException
Flushes all written data and finalizes the resource.After calling this method, the resource is visible and accessible to the application. Any remaining buffered data is written, and the writer is closed, preventing further modifications.
- Throws:
java.lang.IllegalStateException
- if this writer is closed.java.io.IOException
- if an error occurs while committing the resource.java.io.IOException
- if an error occurred during the conversion phase.
-
close
void close()
Closes this writer and clears all uncommitted native resources.This method does nothing if this writer is already closed.
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-