Package com.myscript.iink
Class Engine
- java.lang.Object
-
- com.myscript.iink.Engine
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class Engine extends java.lang.Object implements java.lang.AutoCloseableRepresents the iink runtime environment.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static @NotNull Enginecreate(byte[] certificate)Creates a new engine.@NotNull EditorcreateEditor(@NotNull Renderer renderer)Creates a new editor.@NotNull EditorcreateEditor(@NotNull Renderer renderer, @NotNull ToolController toolController)Creates a new editor.@NotNull ContentPackagecreatePackage(@NotNull java.io.File file)Creates a new package.@NotNull ContentPackagecreatePackage(@NotNull java.lang.String path)Creates a new package.@NotNull ParameterSetcreateParameterSet()Creates a new empty parameter set.@NotNull RecognitionAssetsBuildercreateRecognitionAssetsBuilder()Creates a new RecognitionAssetsBuilder.@NotNull RenderercreateRenderer(float dpiX, float dpiY, @Nullable IRenderTarget renderTarget)Creates a new renderer.@NotNull ToolControllercreateToolController()Creates a new tool controller.voiddeletePackage(@NotNull java.io.File file)Deletes the specified package.voiddeletePackage(@NotNull java.lang.String path)Deletes the specified package.protected voidfinalize()@NotNull ConfigurationgetConfiguration()Returns the configuration associated with this engine.@Nullable java.lang.String[]getSupportedPartTypes()Returns the set of content part types that this engine can handle.booleanisClosed()Tells whether theclose()method has been called.static @NotNull java.lang.StringnativeResources()Lists the number of native objects that are not closed yet.@NotNull ContentPackageopenPackage(@NotNull java.io.File file)Opens the specified package using the EXISTING package open option.@NotNull ContentPackageopenPackage(@NotNull java.io.File file, @NotNull PackageOpenOption openOption)Opens the specified package.@NotNull ContentPackageopenPackage(@NotNull java.lang.String path)Opens the specified package using the EXISTING package open option.@NotNull ContentPackageopenPackage(@NotNull java.lang.String path, @NotNull PackageOpenOption openOption)Opens the specified package.
-
-
-
Method Detail
-
create
@NotNull public static @NotNull Engine create(byte[] certificate) throws java.lang.IllegalArgumentException
Creates a new engine.Note: make sure to close the returned object.
- Parameters:
certificate- the certificate that identifies you as a valid MyScript technology integrator.- Returns:
- the newly created engine.
- Throws:
java.lang.IllegalArgumentException- when the certificate is invalid.
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
close
public final void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
isClosed
public final boolean isClosed()
Tells whether theclose()method has been called. Once an object is closed any method will throwIllegalStateException.- Returns:
trueif this object is closed.
-
getConfiguration
@NotNull public final @NotNull Configuration getConfiguration()
Returns the configuration associated with this engine.Note: do not close the returned object as it is owned by the engine.
- Returns:
- the engine configuration.
- Throws:
java.lang.IllegalStateException- when this engine is closed.
-
createPackage
@NotNull public final @NotNull ContentPackage createPackage(@NotNull @NotNull java.io.File file) throws java.io.IOException
Creates a new package.Note: make sure to close the returned object.
- Parameters:
file- the package file.- Returns:
- the package.
- Throws:
java.lang.IllegalStateException- when this engine is closed.java.io.IOException- if a package with associated filename already exists.java.io.IOException- if an I/O operation fails.java.lang.IllegalArgumentException- if a package associated with the same filename is already opened, it can be accessed via a call to openPackage().
-
createPackage
@NotNull public final @NotNull ContentPackage createPackage(@NotNull @NotNull java.lang.String path) throws java.io.IOException
Creates a new package.Note: make sure to close the returned object.
- Parameters:
path- the package file path.- Returns:
- the package.
- Throws:
java.lang.IllegalStateException- when this engine is closed.java.io.IOException- if a package with associated filename already exists.java.io.IOException- if an I/O operation fails.java.lang.IllegalArgumentException- if a package associated with the same filename is already opened, it can be accessed via a call to openPackage().
-
openPackage
@NotNull public final @NotNull ContentPackage openPackage(@NotNull @NotNull java.io.File file) throws java.io.IOException
Opens the specified package using the EXISTING package open option.Note: make sure to close the returned object.
- Parameters:
file- the package file.- Returns:
- the package.
- Throws:
java.lang.IllegalStateException- when this engine is closed.java.io.IOException- if a package with associated filename does not exist.java.io.IOException- if an I/O operation fails.
-
openPackage
@NotNull public final @NotNull ContentPackage openPackage(@NotNull @NotNull java.io.File file, @NotNull @NotNull PackageOpenOption openOption) throws java.io.IOException
Opens the specified package.Note: make sure to close the returned object.
- Parameters:
file- the package file.openOption- the open option used to open the package file.- Returns:
- the package.
- Throws:
java.lang.IllegalStateException- when this engine is closed.java.io.IOException- whenopenOptionisEXISTING, if a package with associated filename does not exist.java.io.IOException- whenopenOptionisCREATE_NEW, if a package with associated filename already exists.java.lang.IllegalArgumentException- whenopenOptionisCREATE_NEW, if a package associated with the same filename is already opened.java.io.IOException- if an I/O operation fails.- Since:
- 1.2
-
openPackage
@NotNull public final @NotNull ContentPackage openPackage(@NotNull @NotNull java.lang.String path) throws java.io.IOException
Opens the specified package using the EXISTING package open option.Note: make sure to close the returned object.
- Parameters:
path- the package file path.- Returns:
- the package.
- Throws:
java.lang.IllegalStateException- when this engine is closed.java.io.IOException- if a package with associated filename does not exist.java.io.IOException- if an I/O operation fails.
-
openPackage
@NotNull public final @NotNull ContentPackage openPackage(@NotNull @NotNull java.lang.String path, @NotNull @NotNull PackageOpenOption openOption) throws java.io.IOException
Opens the specified package.Note: make sure to close the returned object.
- Parameters:
path- the package file path.openOption- the open option used to open the package file.- Returns:
- the package.
- Throws:
java.lang.IllegalStateException- when this engine is closed.java.io.IOException- whenopenOptionisEXISTING, if a package with associated filename does not exist.java.io.IOException- whenopenOptionisCREATE_NEW, if a package with associated filename already exists.java.lang.IllegalArgumentException- whenopenOptionisCREATE_NEW, if a package associated with the same filename is already opened.java.io.IOException- if an I/O operation fails.- Since:
- 1.2
-
deletePackage
public final void deletePackage(@NotNull @NotNull java.io.File file) throws java.io.IOException, java.lang.IllegalArgumentExceptionDeletes the specified package.- Parameters:
file- the package file.- Throws:
java.lang.IllegalStateException- when this engine is closed.java.io.IOException- if an I/O operation fails.java.lang.IllegalArgumentException- when a package associated with the same fileName is already opened.- Since:
- 1.2
-
deletePackage
public final void deletePackage(@NotNull @NotNull java.lang.String path) throws java.io.IOException, java.lang.IllegalArgumentExceptionDeletes the specified package.- Parameters:
path- the package file path.- Throws:
java.lang.IllegalStateException- when this engine is closed.java.io.IOException- if an I/O operation fails.java.lang.IllegalArgumentException- when a package associated with the same fileName is already opened.- Since:
- 1.2
-
createRenderer
@NotNull public final @NotNull Renderer createRenderer(float dpiX, float dpiY, @Nullable @Nullable IRenderTarget renderTarget)
Creates a new renderer.Note: make sure to close the returned object.
- Parameters:
dpiX- the physical horizontal resolution of the display in dots per inch.dpiY- the physical vertical resolution of the display in dots per inch.renderTarget- the render target.- Returns:
- the newly created renderer.
- Throws:
java.lang.IllegalStateException- when this engine is closed.java.lang.IllegalArgumentException- whendpiXis not a number.java.lang.IllegalArgumentException- whendpiXis negative.java.lang.IllegalArgumentException- whendpiYis not a number.java.lang.IllegalArgumentException- whendpiYis negative.
-
createToolController
@NotNull public final @NotNull ToolController createToolController()
Creates a new tool controller.- Returns:
- the newly created tool controller.
- Throws:
java.lang.IllegalStateException- when this engine is closed.- Since:
- 2.0
-
createEditor
@NotNull public final @NotNull Editor createEditor(@NotNull @NotNull Renderer renderer)
Creates a new editor.- Parameters:
renderer- the renderer to be used to display editor's content.- Returns:
- the newly created editor, with default tool controller.
- Throws:
java.lang.IllegalStateException- when this engine is closed.
-
createEditor
@NotNull public final @NotNull Editor createEditor(@NotNull @NotNull Renderer renderer, @NotNull @NotNull ToolController toolController)
Creates a new editor.- Parameters:
renderer- the renderer to be used to display editor's content.toolController- the tool controller to be used to manage tools.- Returns:
- the newly created editor.
- Throws:
java.lang.IllegalStateException- when this engine is closed.- Since:
- 2.0
-
getSupportedPartTypes
@Nullable public final @Nullable java.lang.String[] getSupportedPartTypes()
Returns the set of content part types that this engine can handle.- Returns:
- an unmodifiable set of the handled content type names.
- Throws:
java.lang.IllegalStateException- when this engine is closed.
-
createParameterSet
@NotNull public final @NotNull ParameterSet createParameterSet()
Creates a new empty parameter set.- Returns:
- the newly created parameter set.
- Throws:
java.lang.IllegalStateException- when this engine is closed.
-
createRecognitionAssetsBuilder
@NotNull public final @NotNull RecognitionAssetsBuilder createRecognitionAssetsBuilder()
Creates a new RecognitionAssetsBuilder.- Returns:
- the newly created recognition assets builder.
- Throws:
java.lang.IllegalStateException- when this engine is closed.- Since:
- 1.2.4
-
nativeResources
@NotNull public static @NotNull java.lang.String nativeResources()
Lists the number of native objects that are not closed yet.- Returns:
- a string describing the native resources currently in use.
- Since:
- 2.0.3
-
-