/** * Returns an instance of this text extractor.<p> * * @return an instance of this text extractor */ public static I_CmsTextExtractor getExtractor() { // since this extractor requires a member variable we have no static instance return new CmsExtractorMsPowerPoint(); }
/** * @see org.opencms.search.extractors.I_CmsTextExtractor#extractText(java.io.InputStream, java.lang.String) */ @Override public I_CmsExtractionResult extractText(InputStream in, String encoding) throws Exception { String rawContent = ""; try { POIFSReader reader = new POIFSReader(); reader.registerListener(this); reader.read(in); // extract all information rawContent = removeControlChars(m_buffer.toString()); // free buffer memory m_buffer = new StringBuffer(4096); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().container(Messages.LOG_EXTRACT_TEXT_ERROR_0), e); } } // combine the meta information with the content and create the result return createExtractionResult(rawContent); }
/** * Returns the raw text content of a given vfs resource containing MS PowerPoint data.<p> * * @see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, CmsSearchIndex) */ public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, CmsSearchIndex index) throws CmsIndexException, CmsException { CmsFile file = readFile(cms, resource); try { return CmsExtractorMsPowerPoint.getExtractor().extractText(file.getContents()); } catch (Exception e) { throw new CmsIndexException( Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()), e); } }
i = appendTextChars(ENCODING_CP1252, i, size, buffer); break; case PPT_TEXTCHAR_ATOM: i = appendTextChars(ENCODING_UTF16, i, size, buffer); break; default:
textExtractor = CmsExtractorRtf.getExtractor(); } else if (path1.endsWith(".ppt") && path2.endsWith(".ppt")) { textExtractor = CmsExtractorMsPowerPoint.getExtractor();