Class PayloadRouter
java.lang.Object
org.apache.tika.pipes.core.fetcher.PayloadRouter
Decides how a document reaches the forked worker: as bytes on the wire, or as a file the
worker opens itself.
Every host that hands pipes an already-open stream needs this same decision, so it lives here rather than in each of them -- three copies would be three thresholds that drift apart.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic final classThe outcome.static interfaceCreates the file a SPOOLED payload is written to. -
Method Summary
Modifier and TypeMethodDescriptionstatic PayloadRouter.Routedroute(InputStream is, int maxInlineBytes, PayloadRouter.SpoolTarget spoolTarget) Reads a stream the same wayroute(org.apache.tika.io.TikaInputStream, int, org.apache.tika.pipes.core.fetcher.PayloadRouter.SpoolTarget)does; for callers holding a plain stream.static PayloadRouter.Routedroute(TikaInputStream tis, int maxInlineBytes, PayloadRouter.SpoolTarget spoolTarget) Routestis, reading no more than it must to decide.
-
Method Details
-
route
public static PayloadRouter.Routed route(TikaInputStream tis, int maxInlineBytes, PayloadRouter.SpoolTarget spoolTarget) throws IOException Routestis, reading no more than it must to decide.A stream that already has a file keeps it: reading an on-disk document into heap to push it through a socket is strictly worse than letting the worker open the file. Otherwise the decision is made from bytes actually read -- a declared length is absent under chunked transfer encoding and client-supplied besides.
- Parameters:
tis- the content; not closed heremaxInlineBytes- largest payload carried inline; 0 disables inliningspoolTarget- invoked only if the content exceedsmaxInlineBytes- Throws:
IOException
-
route
public static PayloadRouter.Routed route(InputStream is, int maxInlineBytes, PayloadRouter.SpoolTarget spoolTarget) throws IOException Reads a stream the same wayroute(org.apache.tika.io.TikaInputStream, int, org.apache.tika.pipes.core.fetcher.PayloadRouter.SpoolTarget)does; for callers holding a plain stream.- Throws:
IOException
-