关于POI读取Excel2007的错误InvalidFormatException: Package should contain的解决方法

关于POI读取Excel2007的异常InvalidFormatException: Package should contain的解决办法
    此解决办法来源百度知道上面的一位老兄,在此表示感谢.
    以下为代码:
   public static Workbook create(InputStream in) throws     
     IOException,InvalidFormatException {
	    if (!in.markSupported()) {
	        in = new PushbackInputStream(in, 8);
	    }
	    if (POIFSFileSystem.hasPOIFSHeader(in)) {
	        return new HSSFWorkbook(in);
	    }
	    if (POIXMLDocument.hasOOXMLHeader(in)) {
	        return new XSSFWorkbook(OPCPackage.open(in));
	    }
	    throw new IllegalArgumentException("你的excel版本目前poi解析不了");
	}