Class BytesFetcher
java.lang.Object
org.apache.tika.pipes.core.fetcher.BytesFetcher
- All Implemented Interfaces:
Fetcher,TikaExtension,org.pf4j.ExtensionPoint
Serves the bytes a caller put in the
InlineBytes parse-context entry, so a host that
already holds the content does not have to spool it to disk purely to hand it across the
process boundary.
The fetch key is not a location -- it carries the caller's filename, which is why the parent no longer has to scrub a spool filename out of the returned metadata.
FetcherManager hands out one instance per id and
requires thread safety, so the payload is read from the parseContext argument on every
call and never held as state.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringReserved: a request cannot name this, so only the host can route a parse through it. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfetch(String fetchKey, Metadata metadata, ParseContext parseContext) Fetches a resource and returns it as a TikaInputStream.
-
Field Details
-
FETCHER_ID
Reserved: a request cannot name this, so only the host can route a parse through it.- See Also:
-
-
Constructor Details
-
BytesFetcher
public BytesFetcher()
-
-
Method Details
-
fetch
public TikaInputStream fetch(String fetchKey, Metadata metadata, ParseContext parseContext) throws TikaException, IOException Description copied from interface:FetcherFetches a resource and returns it as a TikaInputStream.- Specified by:
fetchin interfaceFetcher- Parameters:
fetchKey- the key identifying the resource to fetch (interpretation depends on the implementation, e.g., file path, URL, S3 key)metadata- metadata object to be updated with resource informationparseContext- the parse context- Returns:
- a TikaInputStream for reading the resource content
- Throws:
TikaException- if a Tika-specific error occurs during fetchingIOException- if an I/O error occurs during fetching
-
getExtensionConfig
- Specified by:
getExtensionConfigin interfaceTikaExtension
-