我正在使用Apache poi 3.8来读取xls文件,但是遇到了异常:
java.io.IOException: Unable to read entire header; 0 bytes read; expected 512 bytes
at org.apache.poi.poifs.storage.HeaderBlock.alertShortRead(HeaderBlock.java:226)
at org.apache.poi.poifs.storage.HeaderBlock.readFirst512(HeaderBlock.java:207)
at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:104)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:138)
使用的代码示例:
FileInputStream myInput = new FileInputStream(excelFilePathWithExtension);
logger.debug("FileInputStream::"+myInput);
POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput);
logger.debug("POIFSFileSystem::"+myFileSystem);
Workbook workbook = WorkbookFactory.create(myFileSystem);
请帮助我吗?
(需要翻译的内容)