Package org.apache.tika.extractor
Class DefaultEmbeddedStreamTranslator
java.lang.Object
org.apache.tika.extractor.DefaultEmbeddedStreamTranslator
- All Implemented Interfaces:
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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
shouldTranslate
(InputStream inputStream, Metadata metadata) This should sniff the stream to determine if it needs to be translated.translate
(InputStream inputStream, Metadata metadata) This will consume the InputStream and return a new stream of translated bytes.
-
Constructor Details
-
DefaultEmbeddedStreamTranslator
public DefaultEmbeddedStreamTranslator()
-
-
Method Details
-
shouldTranslate
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
This will consume the InputStream and return a new stream of translated bytes.- Specified by:
translate
in interfaceEmbeddedStreamTranslator
- Parameters:
inputStream
-metadata
-- Returns:
- Throws:
IOException
-