Results 1 to 6 of 6
  1. #1
    kushagra is offline Member
    Join Date
    Oct 2008
    Posts
    12
    Rep Power
    0

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

    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
    :)

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,331
    Rep Power
    25

    Default

    Do you have the doc for the program that issued that error message? What does it say?
    Why is it expecting 512 bytes?
    What is in the Resources.doc file? Is it properly formatted?
    How was it created? Does it open OK in Word?

  3. #3
    kushagra is offline Member
    Join Date
    Oct 2008
    Posts
    12
    Rep Power
    0

    Default

    Hi,
    I have one doc file name "Performance Management Resources.doc" in which I have added few hidden parameter and then I read the data then it was giving the error.
    Moreover is there a way so that we can convert the msword docs into xml.

    Thanks
    Kushagra

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,331
    Rep Power
    25

    Default

    I have added few hidden parameter
    Did you do that correctly? Do other programs have any problems opening the file that you modified?

  5. #5
    kushagra is offline Member
    Join Date
    Oct 2008
    Posts
    12
    Rep Power
    0

    Default

    Hi
    I am just adding few parameter in the word docs. But I now I come to know that I was creating them in the wrong direction. Can you please tell me that how can I add my own custom properties in the Word documet. I think there is a way in java.io by which we can add some custom properties in the ms-word.

    Or is there any other way by which I can add some parameter.

    Thanks
    Kushagra

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,331
    Rep Power
    25

    Default

    how can I add my own custom properties in the Word documet.
    Do you have documentation on the layout of a word document file?
    You'll need that to be able to correctly modify/write to a word doc file. It is not part of Sun's java.

Similar Threads

  1. help to read .pst file through java
    By umadas in forum Advanced Java
    Replies: 2
    Last Post: 12-19-2010, 04:32 AM
  2. DES algorithm (Read and Write bytes to file)
    By JoaoPe in forum Advanced Java
    Replies: 6
    Last Post: 07-29-2008, 03:46 PM
  3. How to read an image in Java
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-25-2008, 10:30 AM
  4. Replies: 1
    Last Post: 08-08-2007, 01:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •