Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic