Package org.apache.tika.extractor
Class DefaultEmbeddedStreamTranslator
- java.lang.Object
-
- org.apache.tika.extractor.DefaultEmbeddedStreamTranslator
-
- All Implemented Interfaces:
EmbeddedStreamTranslator
public class DefaultEmbeddedStreamTranslator extends Object implements EmbeddedStreamTranslator
Loads EmbeddedStreamTranslators via service loading. Tries to run each in turn and returns the first non-null value. If no translation has occurred, this returns the original InputStream. If a translation has occurred, the translator will consume the InputStream but not close it.
-
-
Constructor Summary
Constructors Constructor Description DefaultEmbeddedStreamTranslator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
shouldTranslate(InputStream inputStream, Metadata metadata)
This should sniff the stream to determine if it needs to be translated.InputStream
translate(InputStream inputStream, Metadata metadata)
This will consume the InputStream and return a new stream of translated bytes.
-
-
-
Method Detail
-
shouldTranslate
public boolean shouldTranslate(InputStream inputStream, Metadata metadata) throws IOException
This should sniff the stream to determine if it needs to be translated. The translator is responsible for resetting the stream if any bytes have been read.- Specified by:
shouldTranslate
in interfaceEmbeddedStreamTranslator
- Parameters:
inputStream
-metadata
-- Returns:
- Throws:
IOException
-
translate
public InputStream translate(InputStream inputStream, Metadata metadata) throws IOException
This will consume the InputStream and return a new stream of translated bytes.- Specified by:
translate
in interfaceEmbeddedStreamTranslator
- Parameters:
inputStream
-metadata
-- Returns:
- Throws:
IOException
-
-