Package com.myscript.iink
Class HandwritingProfileBuilder
java.lang.Object
com.myscript.iink.HandwritingProfileBuilder
- All Implemented Interfaces:
AutoCloseable
A builder for handwriting profiles.
- Since:
- 4.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()final @NotNull HandwritingProfilecreateFromFile(@NotNull String fileName) Creates a writing profile from a ContentPackage file name.final @NotNull HandwritingProfilecreateFromSelection(@NotNull ContentSelection selection) Creates a writing profile from a ContentSelection.protected voidfinalize()final @NotNull HandwritingProfilegetPredefinedProfileAt(int index) Returns the predefined writing profile at the given index.final intRetrieves the number of predefined writing profiles.final booleanisClosed()Tells whether theclose()method has been called.final @NotNull HandwritingProfileLoads a writing profile from file.final voidstore(@NotNull HandwritingProfile profile, @NotNull String fileName) Stores a writing profile to file.
-
Method Details
-
finalize
-
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
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.
-
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
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 isnullor does not contain enough recognized text.
-
createFromFile
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
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.
-