I've been using POI for a while now to load Excel data into a java app.
Works great, thanks a bunch.
This week we decided to zip the directory containing the excel file and
read it from a zipfile stream. When I try I get exceptions like:
java.io.IOException: Unable to read entire block; 361 bytes
read; expected 512 bytes
java.lang.Throwable(java.lang.String)
java.lang.Exception(java.lang.String)
java.io.IOException(java.lang.String)
org.apache.poi.poifs.storage.RawDataBlock(java.io.InputStream)
org.apache.poi.poifs.storage.RawDataBlockList(java.io.InputStream)
org.apache.poi.poifs.filesystem.POIFSFileSystem(java.io.InputStream)
When I read the data out of the zipstream like this:
ZipEntry entry = zipfile.getEntry("foo.xls");
InputStream is = zipfile.getInputStream(entry);
int entrysize = (int) entry.getSize();
byte[] bytes = new byte[entrysize];
int read = is.read(bytes, 0, entrysize);
while (read < entrysize)
{
read += is.read(bytes, read, entrysize - read);
}
And then give POIFSFileSystem a new ByteArrayInputStream(bytes) it works
fine.
Known bug? User error?
Thanks
Lloyd Fischer
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>