Package org.apache.poi.hslf.extractor
Class QuickButCruddyTextExtractor
java.lang.Object
org.apache.poi.hslf.extractor.QuickButCruddyTextExtractor
This class will get all the text from a Powerpoint Document, including
all the bits you didn't want, and in a somewhat random order, but will
do it very fast.
The class ignores most of the hslf classes, and doesn't use
HSLFSlideShow. Instead, it just does a very basic scan through the
file, grabbing all the text records as it goes. It then returns the
text, either as a single string, or as a vector of all the individual
strings.
Because of how it works, it will return a lot of "crud" text that you
probably didn't want! It will return text from master slides. It will
return duplicate text, and some mangled text (powerpoint files often
have duplicate copies of slide text in them). You don't get any idea
what the text was associated with.
Almost everyone will want to use @see PowerPointExtractor instead. There
are only a very small number of cases (eg some performance sensitive
lucene indexers) that would ever want to use this!
-
Constructor Summary
ConstructorsConstructorDescriptionQuickButCruddyTextExtractor
(InputStream iStream) Creates an extractor from a given input streamQuickButCruddyTextExtractor
(String fileName) Creates an extractor from a given file nameCreates an extractor from a POIFS Filesystem -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Shuts down the underlying streamsint
findTextRecords
(int startPos, List<String> textV) For the given position, look if the record is a text record, and wind on after.Fetches the ALL the text of the powerpoint file, as a single stringFetches the ALL the text of the powerpoint file, in a List of strings, one per text recordstatic void
Really basic text extractor, that will also return lots of crud text.
-
Constructor Details
-
QuickButCruddyTextExtractor
Creates an extractor from a given file name- Parameters:
fileName
-- Throws:
IOException
-
QuickButCruddyTextExtractor
Creates an extractor from a given input stream- Parameters:
iStream
-- Throws:
IOException
-
QuickButCruddyTextExtractor
Creates an extractor from a POIFS Filesystem- Parameters:
poifs
-- Throws:
IOException
-
-
Method Details
-
main
Really basic text extractor, that will also return lots of crud text. Takes a single argument, the file to extract from- Throws:
IOException
-
close
Shuts down the underlying streams- Throws:
IOException
-
getTextAsString
Fetches the ALL the text of the powerpoint file, as a single string -
getTextAsVector
Fetches the ALL the text of the powerpoint file, in a List of strings, one per text record -
findTextRecords
For the given position, look if the record is a text record, and wind on after. If it is a text record, grabs out the text. Whatever happens, returns the position of the next record, or -1 if no more.
-