When opening a file with POIFSFileSystem fs = new POIFSFileSystem(fis); if this file have a size not modulus 0x200 then an exception occured. It's seem that old Ole Document can have this size for example : 539 990 bytes (0x83D56). If the file is re save with new softwar, then the size is : 603 136 bytes (0x93400) I have done a patch in RawDataBlock _data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ]; int count = IOUtils.readFully(stream, _data); if (count == -1) { _eof = true; } else if (count != POIFSConstants.BIG_BLOCK_SIZE) { String type = " byte" + ((count == 1) ? ("") : ("s")); /* throw new IOException("Unable to read entire block; " + count + type + " read; expected " + POIFSConstants.BIG_BLOCK_SIZE + " bytes"); */ System.err.println("Unable to read entire block; " + count + type + " read; expected " + POIFSConstants.BIG_BLOCK_SIZE + " bytes" ); } else { _eof = false; }
I'm thinking this has to be a really old document that doesn't conform to the current model for OLE documents. Under the current model, documents have to be written in blocks and the block size is a power of 2. The only block size that would make sense for the document cited is *2 bytes*, which would be extremely inefficient.