Class Tess4JConfig.RuntimeConfig

java.lang.Object
org.apache.tika.parser.ocr.tess4j.Tess4JConfig
org.apache.tika.parser.ocr.tess4j.Tess4JConfig.RuntimeConfig
All Implemented Interfaces:
Serializable
Enclosing class:
Tess4JConfig

public static class Tess4JConfig.RuntimeConfig extends Tess4JConfig
Runtime-only Tess4JConfig that prevents modification of paths and pool settings during parse-time configuration.

Always blocked: dataPath, nativeLibPath, poolSize, maxImagePixels.

Paths are blocked to prevent file-system access attacks. Pool size is blocked because the pool is built at init time and cannot be resized. maxImagePixels is read per parse, but it is the OOM guard on image decode, so a caller must not be able to raise it.

See Also:
  • Constructor Details

    • RuntimeConfig

      public RuntimeConfig()
  • Method Details

    • setDataPath

      public void setDataPath(String dataPath) throws TikaConfigException
      Description copied from class: Tess4JConfig
      Set the path to the tessdata directory.
      Overrides:
      setDataPath in class Tess4JConfig
      Throws:
      TikaConfigException
    • setNativeLibPath

      public void setNativeLibPath(String nativeLibPath) throws TikaConfigException
      Description copied from class: Tess4JConfig
      Set the path to the directory containing native Tesseract/Leptonica shared libraries. On macOS with Homebrew this is typically /opt/homebrew/lib.
      Overrides:
      setNativeLibPath in class Tess4JConfig
      Throws:
      TikaConfigException
    • setPoolSize

      public void setPoolSize(int poolSize)
      Description copied from class: Tess4JConfig
      Set the number of Tesseract instances to keep in the pool. Default is 2. Must be at least 1.
      Overrides:
      setPoolSize in class Tess4JConfig
    • setMaxImagePixels

      public void setMaxImagePixels(long maxImagePixels)
      Description copied from class: Tess4JConfig
      Set the maximum total pixels (width × height) allowed for an image before OCR is skipped. Default is 100,000,000 (100 megapixels). Set to -1 for no limit (not recommended).
      Overrides:
      setMaxImagePixels in class Tess4JConfig