Package com.myscript.iink
Class Engine
java.lang.Object
com.myscript.iink.Engine
- All Implemented Interfaces:
AutoCloseable
Represents the iink runtime environment.
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
close()
static @NotNull Engine
create
(byte[] certificate) Creates a new engine.final @NotNull Editor
createEditor
(@NotNull Renderer renderer) Creates a new editor.final @NotNull Editor
createEditor
(@NotNull Renderer renderer, @NotNull ToolController toolController) Creates a new editor.final @NotNull ItemIdHelper
createItemIdHelper
(@NotNull OffscreenEditor offscreenEditor) Creates a new item id helper associated with an offscreen editor.final @NotNull OffscreenEditor
createOffscreenEditor
(float scaleX, float scaleY) Creates a new offscreen editor.final @NotNull ContentPackage
createPackage
(@NotNull File file) Creates a new package.final @NotNull ContentPackage
createPackage
(@NotNull String path) Creates a new package.final @NotNull ParameterSet
Creates a new empty parameter set.final @NotNull RecognitionAssetsBuilder
Creates a new RecognitionAssetsBuilder.final @NotNull Recognizer
createRecognizer
(float scaleX, float scaleY, @NotNull String type) Creates a new recognizer.final @NotNull Renderer
createRenderer
(float dpiX, float dpiY, @Nullable IRenderTarget renderTarget) Creates a new renderer.final @NotNull ToolController
Creates a new tool controller.final void
deletePackage
(@NotNull File file) Deletes the specified package.final void
deletePackage
(@NotNull String path) Deletes the specified package.protected void
finalize()
final @NotNull Configuration
Returns the configuration associated with this engine.final @Nullable String[]
Returns the set of content part types that this engine can handle.final @Nullable String[]
Lists the recognizer types supported by this engine.final @NotNull String
Returns the version of iink SDK.final boolean
isClosed()
Tells whether theclose()
method has been called.static @NotNull String
Lists the number of native objects that are not closed yet.final @NotNull ContentPackage
openPackage
(@NotNull File file) Opens the specified package using the EXISTING package open option.final @NotNull ContentPackage
openPackage
(@NotNull File file, @NotNull PackageOpenOption openOption) Opens the specified package.final @NotNull ContentPackage
openPackage
(@NotNull String path) Opens the specified package using the EXISTING package open option.final @NotNull ContentPackage
openPackage
(@NotNull String path, @NotNull PackageOpenOption openOption) Opens the specified package.
-
Method Details
-
create
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:
IllegalArgumentException
- when the certificate is invalid.
-
finalize
-
close
public final void close()- Specified by:
close
in interfaceAutoCloseable
-
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.
-
getVersion
Returns the version of iink SDK.- Returns:
- the iink SDK version.
- Throws:
IllegalStateException
- when this engine is closed.- Since:
- 2.3
-
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:
IllegalStateException
- when this engine is closed.
-
createPackage
@NotNull public final @NotNull ContentPackage createPackage(@NotNull @NotNull File file) throws IOException Creates a new package.Note: make sure to close the returned object.
- Parameters:
file
- the package file.- Returns:
- the package.
- Throws:
IllegalStateException
- when this engine is closed.IOException
- if a package with associated filename already exists.IOException
- if an I/O operation fails.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 String path) throws IOException Creates a new package.Note: make sure to close the returned object.
- Parameters:
path
- the package file path.- Returns:
- the package.
- Throws:
IllegalStateException
- when this engine is closed.IOException
- if a package with associated filename already exists.IOException
- if an I/O operation fails.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 File file) throws 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:
IllegalStateException
- when this engine is closed.IOException
- if a package with associated filename does not exist.IOException
- if an I/O operation fails.
-
openPackage
@NotNull public final @NotNull ContentPackage openPackage(@NotNull @NotNull File file, @NotNull @NotNull PackageOpenOption openOption) throws 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:
IllegalStateException
- when this engine is closed.IOException
- whenopenOption
isEXISTING
, if a package with associated filename does not exist.IOException
- whenopenOption
isCREATE_NEW
, if a package with associated filename already exists.IllegalArgumentException
- whenopenOption
isCREATE_NEW
, if a package associated with the same filename is already opened.IOException
- if an I/O operation fails.- Since:
- 1.2
-
openPackage
@NotNull public final @NotNull ContentPackage openPackage(@NotNull @NotNull String path) throws 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:
IllegalStateException
- when this engine is closed.IOException
- if a package with associated filename does not exist.IOException
- if an I/O operation fails.
-
openPackage
@NotNull public final @NotNull ContentPackage openPackage(@NotNull @NotNull String path, @NotNull @NotNull PackageOpenOption openOption) throws 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:
IllegalStateException
- when this engine is closed.IOException
- whenopenOption
isEXISTING
, if a package with associated filename does not exist.IOException
- whenopenOption
isCREATE_NEW
, if a package with associated filename already exists.IllegalArgumentException
- whenopenOption
isCREATE_NEW
, if a package associated with the same filename is already opened.IOException
- if an I/O operation fails.- Since:
- 1.2
-
deletePackage
public final void deletePackage(@NotNull @NotNull File file) throws IOException, IllegalArgumentException Deletes the specified package.- Parameters:
file
- the package file.- Throws:
IllegalStateException
- when this engine is closed.IOException
- if an I/O operation fails.IllegalArgumentException
- when a package associated with the same fileName is already opened.- Since:
- 1.2
-
deletePackage
public final void deletePackage(@NotNull @NotNull String path) throws IOException, IllegalArgumentException Deletes the specified package.- Parameters:
path
- the package file path.- Throws:
IllegalStateException
- when this engine is closed.IOException
- if an I/O operation fails.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:
IllegalStateException
- when this engine is closed.IllegalArgumentException
- whendpiX
is not a number, is zero or is negative.IllegalArgumentException
- whendpiY
is not a number, is zero or is negative.
-
createToolController
Creates a new tool controller.- Returns:
- the newly created tool controller.
- Throws:
IllegalStateException
- when this engine is closed.- Since:
- 2.0
-
createEditor
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:
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:
IllegalStateException
- when this engine is closed.- Since:
- 2.0
-
createOffscreenEditor
Creates a new offscreen editor.- Parameters:
scaleX
- the scale to convert input horizontal coordinates unit into mm.scaleY
- the scale to convert input vertical coordinates unit into mm.- Returns:
- the newly created offscreen editor.
- Throws:
IllegalStateException
- when this engine is closed.IllegalArgumentException
- whenscaleX
is not a number, is zero or is negative.IllegalArgumentException
- whenscaleY
is not a number, is zero or is negative.- Since:
- 2.1
-
createItemIdHelper
@NotNull public final @NotNull ItemIdHelper createItemIdHelper(@NotNull @NotNull OffscreenEditor offscreenEditor) Creates a new item id helper associated with an offscreen editor.- Parameters:
offscreenEditor
- the associated offscreen editor.- Returns:
- the newly created item id helper.
- Throws:
IllegalStateException
- when this engine is closed.NullPointerException
- ifoffscreenEditor
is null.- Since:
- 2.1
-
getSupportedPartTypes
Returns the set of content part types that this engine can handle.- Returns:
- an unmodifiable set of the handled content type names.
- Throws:
IllegalStateException
- when this engine is closed.
-
createParameterSet
Creates a new empty parameter set.- Returns:
- the newly created parameter set.
- Throws:
IllegalStateException
- when this engine is closed.
-
createRecognitionAssetsBuilder
Creates a new RecognitionAssetsBuilder.- Returns:
- the newly created recognition assets builder.
- Throws:
IllegalStateException
- when this engine is closed.- Since:
- 1.2.4
-
getSupportedRecognizerTypes
Lists the recognizer types supported by this engine.- Returns:
- an unmodifiable set of the handled recognizer type names.
- Throws:
IllegalStateException
- when this engine is closed.- Since:
- 2.1
-
createRecognizer
@NotNull public final @NotNull Recognizer createRecognizer(float scaleX, float scaleY, @NotNull @NotNull String type) Creates a new recognizer.- Parameters:
scaleX
- the scale to convert input horizontal coordinates unit into mm.scaleY
- the scale to convert input vertical coordinates unit into mm.type
- the type of recognizer.- Returns:
- the newly created recognizer.
- Throws:
IllegalStateException
- when this engine is closed.IllegalArgumentException
- whenscaleX
is not a number, is zero or is negative.IllegalArgumentException
- whenscaleY
is not a number, is zero or is negative.IllegalArgumentException
- whentype
is not a supported recognizer type.IllegalStateException
- whentype
is "Text" and the search path of the configuration manager is empty.IllegalStateException
- whentype
is "Text", guides are enabled and the language does not allow guides.IllegalStateException
- whentype
is "Text", guides are enabled and the line gap is zero or is negative.- Since:
- 2.1
-
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
-