--- HeaderBlockReaderORIG.java Wed Apr 30 07:38:58 2003 +++ HeaderBlockReader.java Wed Oct 29 10:43:11 2003 @@ -105,6 +105,22 @@ { _data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ]; int byte_count = stream.read(_data); + /// XXX Patch + // The read() of java.io.InputStream does not guarantee to provide + // the full amount of requested bytes. It is necessary to repeat the reading + // until the full block is read or eof occured. + // The original source worked fine up to the point of reading Excel-files + // contained in a ZIP-file. + while (byte_count!=-1 && byte_count < POIFSConstants.BIG_BLOCK_SIZE) { + int k = stream.read(_data, byte_count, POIFSConstants.BIG_BLOCK_SIZE-byte_count); + if (k==-1) { + break; + } else { + byte_count += k; + } + } + /// XXX Patch + if (byte_count != POIFSConstants.BIG_BLOCK_SIZE) {