Class Engine

java.lang.Object
com.myscript.iink.Engine
All Implemented Interfaces:
AutoCloseable

public class Engine extends Object implements AutoCloseable
Represents the iink runtime environment.
  • Method Details

    • create

      @NotNull public static @NotNull Engine create(byte[] certificate) throws 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:
      IllegalArgumentException - when the certificate is invalid.
    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • isClosed

      public final boolean isClosed()
      Tells whether the close() method has been called. Once an object is closed any method will throw IllegalStateException.
      Returns:
      true if this object is closed.
    • getVersion

      @NotNull public final @NotNull String getVersion()
      Returns the version of iink SDK.
      Returns:
      the iink SDK version.
      Throws:
      IllegalStateException - when this engine is closed.
      Since:
      2.3
    • 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:
      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 - when openOption is EXISTING, if a package with associated filename does not exist.
      IOException - when openOption is CREATE_NEW, if a package with associated filename already exists.
      IllegalArgumentException - when openOption is CREATE_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 - when openOption is EXISTING, if a package with associated filename does not exist.
      IOException - when openOption is CREATE_NEW, if a package with associated filename already exists.
      IllegalArgumentException - when openOption is CREATE_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 - when dpiX is not a number, is zero or is negative.
      IllegalArgumentException - when dpiY is not a number, is zero or is negative.
    • createToolController

      @NotNull public final @NotNull ToolController createToolController()
      Creates a new tool controller.
      Returns:
      the newly created tool controller.
      Throws:
      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:
      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

      @NotNull public final @NotNull OffscreenEditor createOffscreenEditor(float scaleX, float scaleY)
      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 - when scaleX is not a number, is zero or is negative.
      IllegalArgumentException - when scaleY 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 - if offscreenEditor is null.
      Since:
      2.1
    • getSupportedPartTypes

      @Nullable public final @Nullable 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:
      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:
      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:
      IllegalStateException - when this engine is closed.
      Since:
      1.2.4
    • getSupportedRecognizerTypes

      @Nullable public final @Nullable String[] 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 - when scaleX is not a number, is zero or is negative.
      IllegalArgumentException - when scaleY is not a number, is zero or is negative.
      IllegalArgumentException - when type is not a supported recognizer type.
      IllegalStateException - when type is "Text" and the search path of the configuration manager is empty.
      IllegalStateException - when type is "Text", guides are enabled and the language does not allow guides.
      IllegalStateException - when type is "Text", guides are enabled and the line gap is zero or is negative.
      Since:
      2.1
    • nativeResources

      @NotNull public static @NotNull 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