poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew C. Oliver" <acoli...@apache.org>
Subject Re: Problem reading in a file
Date Tue, 11 Mar 2003 15:06:20 GMT
This means that for what ever reason the InputStream.read is returning 
-1 (for I can't read anything).  I suspect you either don't have 
permission, are pointing at a 0 length file, or something.  Just open an 
input stream to it and try and read from it.. . Debug from there.

DRINKARD, JAMES E (SBCSI) wrote:

>Yes, I used the correct escape characters. I even tried hardcoding the
>path/filename string as an argument and it still fails.
>
>-----Original Message-----
>From: Read, David [mailto:david.read@blueslate.net]
>Sent: Tuesday, March 11, 2003 8:35 AM
>To: 'POI Users List'
>Subject: RE: Problem reading in a file
>
>
>James,
>
>Did you output the value of fileName to prove it isn't mangled in some way?
>Did you escape the backslashes?  i.e.
>
>String fileName = "c:\\temp\\test.xls";
>
>-Dave
>
>-----Original Message-----
>From: DRINKARD, JAMES E (SBCSI) [mailto:jd4147@sbc.com]
>Sent: Tuesday, March 11, 2003 9:23 AM
>To: poi-user@jakarta.apache.org
>Subject: Problem reading in a file
>
>
>Hello All,
>I'm trying to read in an excel file and I keep getting an error due to it
>not being able to read the header? I made the file using POI and then
>populated it with data. That part works fine. Then I try to read that file
>in order to change it using the following code:
>
>try
>    {
>      POIFSFileSystem fs = new POIFSFileSystem(new
>FileInputStream(fileName));  
>  	  HSSFWorkbook wrkBk = new HSSFWorkbook(fs);
>
>fileName is a string variable with the filename and path: ie
>"c:\temp\test.xls".
>
>The error is:
>java.io.IOException: Unable to read entire header; -1 bytes read; expected
>512 bytes
>java.io.IOException: Unable to read entire header; -1 bytes read; expected
>512 bytes
>	at
>org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java
>:114)
>	at
>org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:
>120)
>	at
>com.sbc.ecom.iris.batch.reports.totals.Totals.main(Totals.java:303)
>
>I know from other documentation I read that the header gets read first, so
>if it can't find it or interpret it, I assume this is the error one would
>get.
>
>Any ideas as to what I'm doing wrong?
>
>Thanks,
>James
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>
>  
>




Mime
View raw message