Class HandwritingProfileBuilder

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

public class HandwritingProfileBuilder extends Object implements AutoCloseable
A builder for handwriting profiles.
Since:
4.1
See Also:
  • Method Details

    • 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.
    • getPredefinedProfileCount

      public final int getPredefinedProfileCount()
      Retrieves the number of predefined writing profiles.
      Returns:
      the number of predefined profiles.
      Throws:
      IllegalStateException - when this handwriting profile builder is closed.
      IllegalStateException - when the number of predefined writing profiles cannot be retrieved.
      Since:
      4.2
    • getPredefinedProfileAt

      @NotNull public final @NotNull HandwritingProfile getPredefinedProfileAt(int index)
      Returns the predefined writing profile at the given index.
      Parameters:
      index - the predefined index of the writing profile.
      Returns:
      the predefined writing profile.
      Throws:
      IllegalStateException - when this handwriting profile builder is closed.
      IllegalArgumentException - when index is not valid.
      Since:
      4.2
    • createFromSelection

      @NotNull public final @NotNull HandwritingProfile createFromSelection(@NotNull @NotNull ContentSelection selection)
      Creates a writing profile from a ContentSelection.
      Parameters:
      selection - the content selection to be used for writing profile generation.
      Returns:
      the newly created writing profile.
      Throws:
      IllegalStateException - when this handwriting profile builder is closed.
      IllegalArgumentException - when selection is null or does not contain enough recognized text.
    • createFromFile

      @NotNull public final @NotNull HandwritingProfile createFromFile(@NotNull @NotNull String fileName)
      Creates a writing profile from a ContentPackage file name.
      Parameters:
      fileName - the ContentPackage file name.
      Returns:
      the newly created writing profile.
      Throws:
      IllegalStateException - when this handwriting profile builder is closed.
      IllegalArgumentException - when file cannot be opened.
      IllegalArgumentException - when file does not contain enough recognized text.
    • load

      @NotNull public final @NotNull HandwritingProfile load(@NotNull @NotNull String fileName)
      Loads a writing profile from file.
      Parameters:
      fileName - the file name.
      Returns:
      the newly created writing profile.
      Throws:
      IllegalStateException - when this handwriting profile builder is closed.
      IllegalArgumentException - when `fileName` does not exist.
      IllegalArgumentException - when `fileName` is not a valid file name.
      IllegalStateException - when `fileName` is not a valid profile.
    • store

      public final void store(@NotNull @NotNull HandwritingProfile profile, @NotNull @NotNull String fileName)
      Stores a writing profile to file.
      Parameters:
      profile - the writing profile.
      fileName - the profile file name.
      Throws:
      IllegalStateException - when this handwriting profile builder is closed.
      IllegalStateException - when `profile` is closed.
      IllegalArgumentException - when `profile` is invalid.
      IllegalArgumentException - when `profile` is a predefined HandwritingProfile.
      IllegalStateException - when `profile` cannot be stored.