Class A_CmsTextExtractor
- All Implemented Interfaces:
I_CmsTextExtractor
- Direct Known Subclasses:
CmsExtractorHtml
,CmsExtractorMsOfficeOLE2
,CmsExtractorMsOfficeOOXML
,CmsExtractorOpenOffice
,CmsExtractorPdf
,CmsExtractorRtf
- Since:
- 6.0.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
combineContentItem
(String itemValue, String itemKey, StringBuffer content, Map<String, String> contentItems) Combines a meta information item extracted from the document with the main content buffer and also stores the individual information as item in the Map of content items.extractText
(byte[] content) Extracts the text and meta information from the given binary document.extractText
(byte[] content, String encoding) Extracts the text and meta information from the given binary document, using the specified content encoding.Extracts the text and meta information from the document on the input stream.extractText
(InputStream in, String encoding) Extracts the text and meta information from the document on the input stream, using the specified content encoding.protected CmsExtractionResult
extractText
(InputStream in, org.apache.tika.parser.Parser parser) Parses the given input stream with the provided parser and returns the result as a map of content items.protected String
removeControlChars
(String content) Removes "unwanted" control chars from the given content.
-
Constructor Details
-
A_CmsTextExtractor
public A_CmsTextExtractor()
-
-
Method Details
-
extractText
Description copied from interface:I_CmsTextExtractor
Extracts the text and meta information from the given binary document.The encoding of the input stream is either not required (the document type may have one common default encoding) or the extractor is able to divine the encoding from the provided binary array automatically.
Delivers is the same result as calling
whenI_CmsTextExtractor.extractText(byte[], String)
String == null
.- Specified by:
extractText
in interfaceI_CmsTextExtractor
- Parameters:
content
- the binary content of the document to extract the text from- Returns:
- the extracted text
- Throws:
Exception
- if the text extration fails- See Also:
-
extractText
Description copied from interface:I_CmsTextExtractor
Extracts the text and meta information from the given binary document, using the specified content encoding.The encoding is a hint for the text extractor, if the value given is
null
then the text extractor should try to figure out the encoding itself.- Specified by:
extractText
in interfaceI_CmsTextExtractor
- Parameters:
content
- the binary content of the document to extract the text fromencoding
- the encoding to use- Returns:
- the extracted text
- Throws:
Exception
- if the text extration fails- See Also:
-
extractText
Description copied from interface:I_CmsTextExtractor
Extracts the text and meta information from the document on the input stream.The encoding of the input stream is either not required (the document type may have one common default encoding) or the extractor is able to divine the encoding from the provided input stream automatically.
Delivers is the same result as calling
whenI_CmsTextExtractor.extractText(InputStream, String)
String == null
.- Specified by:
extractText
in interfaceI_CmsTextExtractor
- Parameters:
in
- the input stream for the document to extract the text from- Returns:
- the extracted text and meta information
- Throws:
Exception
- if the text extration fails- See Also:
-
extractText
Description copied from interface:I_CmsTextExtractor
Extracts the text and meta information from the document on the input stream, using the specified content encoding.The encoding is a hint for the text extractor, if the value given is
null
then the text extractor should try to figure out the encoding itself.- Specified by:
extractText
in interfaceI_CmsTextExtractor
- Parameters:
in
- the input stream for the document to extract the text fromencoding
- the encoding to use- Returns:
- the extracted text and meta information
- Throws:
Exception
- if the text extration fails- See Also:
-
combineContentItem
protected void combineContentItem(String itemValue, String itemKey, StringBuffer content, Map<String, String> contentItems) Combines a meta information item extracted from the document with the main content buffer and also stores the individual information as item in the Map of content items.- Parameters:
itemValue
- the value of the item to storeitemKey
- the key in the Map of content itemscontent
- a buffer where to append the content itemcontentItems
- the Map of individual content items
-
extractText
protected CmsExtractionResult extractText(InputStream in, org.apache.tika.parser.Parser parser) throws Exception Parses the given input stream with the provided parser and returns the result as a map of content items.- Parameters:
in
- the input stream for the content to parseparser
- the parser to use- Returns:
- the result of the parsing as a map of content items
- Throws:
Exception
- in case something goes wrong
-
removeControlChars
Removes "unwanted" control chars from the given content.- Parameters:
content
- the content to remove the unwanted control chars from- Returns:
- the content with the unwanted control chars removed
-