Hi All,
I am using third party API poi to read my ms-word document.
And by doing so I am getting the following exception.
java.io.IOException: Unable to read entire block; 493 bytes read before EOF; expected 512 bytes
at org.apache.poi.poifs.storage.RawDataBlock.<init>(R awDataBlock.java:78)
at org.apache.poi.poifs.storage.RawDataBlock.<init>(R awDataBlock.java:50)
at org.apache.poi.poifs.storage.RawDataBlockList.<ini t>(RawDataBlockList.java:52)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<i nit>(POIFSFileSystem.java:93)
at org.apache.poi.hwpf.HWPFDocument.verifyAndBuildPOI FS(HWPFDocument.java:120)
at org.apache.poi.hwpf.extractor.WordExtractor.<init> (WordExtractor.java:49)
Can any body please tell me the possible solution for that. As I have used the following code.
String data = null;
InputStream objInputStream = new FileInputStream("inputDocs/Performance Management Resources.doc");
WordExtractor extractor = new WordExtractor(objInputStream);
bjInputStream.close();
data = extractor.getText();
System.out.println(data);
int wordCount=(data.split(" ")).length;
System.out.println(wordCount);
Please suggest me the solution as I am in urgent need of some solution.
Thanks
Kushagra