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 void
close()
final @NotNull HandwritingProfile
createFromFile
(@NotNull String fileName) Creates a writing profile from a ContentPackage file name.final @NotNull HandwritingProfile
createFromId
(@NotNull PredefinedHandwritingProfileId id) Creates a writing profile from an internal id.final @NotNull HandwritingProfile
createFromSelection
(@NotNull ContentSelection selection) Creates a writing profile from a ContentSelection.protected void
finalize()
final boolean
isClosed()
Tells whether theclose()
method has been called.final @NotNull HandwritingProfile
Loads a writing profile from file.final void
store
(@NotNull HandwritingProfile profile, @NotNull String fileName) Stores a writing profile to file.
-
Method Details
-
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.
-
createFromId
@NotNull public final @NotNull HandwritingProfile createFromId(@NotNull @NotNull PredefinedHandwritingProfileId id) Creates a writing profile from an internal id.- Parameters:
id
- the predefined id of the writing profile.- Returns:
- the newly created writing profile.
- Throws:
IllegalStateException
- when this handwriting profile builder is closed.
-
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 isnull
or 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.
-