Bookmark Topic Watch Topic
  • New Topic

java.io.IOException: Unable to read entire block; 493 bytes read before EOF; expected

 
Kushagra Bindal
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi All,

I am using third party API poi to read/write 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 so that I will not recieve that exception again. 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
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!