Possibly a java version bug, but I tried 1.4RC, 1.3.1 and inside
VisualAge (1.2.2). I get exactly the same result for each.

> -----Original Message-----
> From: Nicola Ken Barozzi [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, July 11, 2002 3:37 PM
> To: POI Users List
> Subject: Re: Error when reading from ZipFileInputStream
> 
> 
> Lloyd Fischer wrote:
> > 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?
> 
> Java version bug?
> 
> -- 
> Nicola Ken Barozzi                   [EMAIL PROTECTED]
>              - verba volant, scripta manent -
>     (discussions get forgotten, just code remains)
> ---------------------------------------------------------------------
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:poi-user-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to