Package org.apache.tika.pipes.core
Class PipesParser
java.lang.Object
org.apache.tika.pipes.core.PipesParser
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intReturns the current server port.booleanReturns whether this parser is using shared server mode.static PipesParserLoads a PipesParser from a configuration file path.static PipesParserload(TikaJsonConfig tikaJsonConfig, PipesConfig pipesConfig, Path tikaConfigPath) Loads a PipesParser from pre-loaded configuration objects.
-
Method Details
-
load
Loads a PipesParser from a configuration file path.This method:
- Loads the JSON configuration
- Pre-extracts plugins before spawning child processes
- Creates the PipesParser with the loaded configuration
- Parameters:
tikaConfigPath- path to the tika-config.json file- Returns:
- a new PipesParser instance
- Throws:
IOException- if reading config or extraction failsTikaConfigException- if configuration is invalid
-
load
public static PipesParser load(TikaJsonConfig tikaJsonConfig, PipesConfig pipesConfig, Path tikaConfigPath) throws IOException Loads a PipesParser from pre-loaded configuration objects.Use this method when you need to modify the PipesConfig before creating the parser (e.g., to override emit strategy).
- Parameters:
tikaJsonConfig- the pre-loaded JSON configurationpipesConfig- the pipes configuration (may be modified by caller)tikaConfigPath- path to the config file (passed to child processes)- Returns:
- a new PipesParser instance
- Throws:
IOException- if plugin extraction fails
-
parse
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getCurrentServerPort
public int getCurrentServerPort()Returns the current server port. For testing purposes only. In shared mode, returns the port of the shared server. In per-client mode, returns the port of the first client's server.- Returns:
- the current server port, or -1 if no server is running
-