Class RecognitionAssetsBuilder

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class RecognitionAssetsBuilder
    extends java.lang.Object
    implements java.lang.AutoCloseable
    The RecognitionAssetsBuilder implements the tools to generate and save recognition assets.
    Since:
    1.2.4
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void checkNotClosed()  
      void close()  
      void compile​(@NotNull java.lang.String type, @NotNull java.lang.String data)
      Compile data into a recognition asset.
      protected void finalize()  
      @Nullable java.lang.String getCompilationErrors()
      Get the last compilation errors.
      @Nullable java.lang.String[] getSupportedRecognitionAssetsTypes()
      Returns the set of recognition assets types that this recognition assets builder can handle.
      boolean isClosed()
      Tells whether the close() method has been called.
      void store​(@NotNull java.lang.String path)
      Save the previously compiled recognition asset.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • finalize

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

        public final void close()
        Specified by:
        close in interface java.lang.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.
      • checkNotClosed

        protected final void checkNotClosed()
      • getSupportedRecognitionAssetsTypes

        @Nullable
        public final @Nullable java.lang.String[] getSupportedRecognitionAssetsTypes()
        Returns the set of recognition assets types that this recognition assets builder can handle.
        Returns:
        an unmodifiable set of the supported recognition assets type names.
        Throws:
        java.lang.IllegalStateException - when this recognition assets builder is closed.
      • compile

        public void compile​(@NotNull
                            @NotNull java.lang.String type,
                            @NotNull
                            @NotNull java.lang.String data)
                     throws java.lang.IllegalArgumentException,
                            java.lang.RuntimeException
        Compile data into a recognition asset.
        Parameters:
        type - the type of asset that will be generated.
        data - the data to compile.
        Throws:
        java.lang.IllegalStateException - when this recognition assets builder is closed.
        java.lang.IllegalArgumentException - when type is not supported.
        java.lang.RuntimeException - when the content of data could not be compiled into a recognition asset.
      • getCompilationErrors

        @Nullable
        public final @Nullable java.lang.String getCompilationErrors()
        Get the last compilation errors.
        Returns:
        a description of the errors that occurred during the last compilation.
        Throws:
        java.lang.IllegalStateException - when this recognition assets builder is closed.
      • store

        public void store​(@NotNull
                          @NotNull java.lang.String path)
                   throws java.io.IOException
        Save the previously compiled recognition asset.
        Parameters:
        path - the path to destination file.
        Throws:
        java.lang.IllegalStateException - when this recognition assets builder is closed.
        java.io.IOException - when there is no valid recognition asset to store.
        java.io.IOException - if an I/O operation fails.