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.AutoCloseable
Represents the iink runtime environment.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static @NotNull Engine
create(byte[] certificate)
Creates a new engine.@NotNull Editor
createEditor(@NotNull Renderer renderer)
Creates a new editor.@NotNull Editor
createEditor(@NotNull Renderer renderer, @NotNull ToolController toolController)
Creates a new editor.@NotNull ContentPackage
createPackage(@NotNull java.io.File file)
Creates a new package.@NotNull ContentPackage
createPackage(@NotNull java.lang.String path)
Creates a new package.@NotNull ParameterSet
createParameterSet()
Creates a new empty parameter set.@NotNull RecognitionAssetsBuilder
createRecognitionAssetsBuilder()
Creates a new RecognitionAssetsBuilder.@NotNull Renderer
createRenderer(float dpiX, float dpiY, @Nullable IRenderTarget renderTarget)
Creates a new renderer.@NotNull ToolController
createToolController()
Creates a new tool controller.void
deletePackage(@NotNull java.io.File file)
Deletes the specified package.void
deletePackage(@NotNull java.lang.String path)
Deletes the specified package.protected void
finalize()
@NotNull Configuration
getConfiguration()
Returns the configuration associated with this engine.@Nullable java.lang.String[]
getSupportedPartTypes()
Returns the set of content part types that this engine can handle.boolean
isClosed()
Tells whether theclose()
method has been called.static @NotNull java.lang.String
nativeResources()
Lists the number of native objects that are not closed yet.@NotNull ContentPackage
openPackage(@NotNull java.io.File file)
Opens the specified package using the EXISTING package open option.@NotNull ContentPackage
openPackage(@NotNull java.io.File file, @NotNull PackageOpenOption openOption)
Opens the specified package.@NotNull ContentPackage
openPackage(@NotNull java.lang.String path)
Opens the specified package using the EXISTING package open option.@NotNull ContentPackage
openPackage(@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:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
close
public final void close()
- Specified by:
close
in 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:
true
if 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
- whenopenOption
isEXISTING
, if a package with associated filename does not exist.java.io.IOException
- whenopenOption
isCREATE_NEW
, if a package with associated filename already exists.java.lang.IllegalArgumentException
- whenopenOption
isCREATE_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
- whenopenOption
isEXISTING
, if a package with associated filename does not exist.java.io.IOException
- whenopenOption
isCREATE_NEW
, if a package with associated filename already exists.java.lang.IllegalArgumentException
- whenopenOption
isCREATE_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.IllegalArgumentException
Deletes 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.IllegalArgumentException
Deletes 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
- whendpiX
is not a number.java.lang.IllegalArgumentException
- whendpiX
is negative.java.lang.IllegalArgumentException
- whendpiY
is not a number.java.lang.IllegalArgumentException
- whendpiY
is 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
-
-