Class BytesFetcher

java.lang.Object
org.apache.tika.pipes.core.fetcher.BytesFetcher
All Implemented Interfaces:
Fetcher, TikaExtension, org.pf4j.ExtensionPoint

public class BytesFetcher extends Object implements Fetcher
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 Details

    • FETCHER_ID

      public static final String 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: Fetcher
      Fetches a resource and returns it as a TikaInputStream.
      Specified by:
      fetch in interface Fetcher
      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 information
      parseContext - the parse context
      Returns:
      a TikaInputStream for reading the resource content
      Throws:
      TikaException - if a Tika-specific error occurs during fetching
      IOException - if an I/O error occurs during fetching
    • getExtensionConfig

      public ExtensionConfig getExtensionConfig()
      Specified by:
      getExtensionConfig in interface TikaExtension