XlsxSheetContentParser.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:rapidminer 作者:
/**
 * Closes the current open {@link XMLStreamReader} and creates a new one which starts the
 * reading process at the first row. It is assumed the the XLSX content and operator
 * configuration remain the same.
 *
 * @param factory
 *            the {@link XMLInputFactory} that should be used to open the
 *            {@link XMLStreamReader}.
 *
 * @throws IOException
 *             if an I/O error has occurred
 * @throws XMLStreamException
 *             if there are errors freeing associated XML reader resources or creating a new XML
 *             reader
 */
void reset(XMLInputFactory xmlFactory) throws IOException, XMLStreamException {

    // close open file and reader object
    close();

    // create new file and stream reader objects
    xlsxZipFile = new ZipFile(xlsxFile);
    ZipEntry workbookZipEntry = xlsxZipFile.getEntry(workbookZipEntryPath);
    if (workbookZipEntry == null) {
        throw new FileNotFoundException(
                "XLSX file is malformed. Reason: Selected workbook is missing in XLSX file. Path: "
                        + workbookZipEntryPath);
    }
    InputStream inputStream = xlsxZipFile.getInputStream(workbookZipEntry);
    reader = xmlFactory.createXMLStreamReader(new InputStreamReader(inputStream, encoding));

    // reset other variables
    currentRowIndex = -1;
    parsedRowIndex = -1;
    currentRowContent = null;
    nextRowWithContent = null;
    hasMoreContent = true;
    Arrays.fill(emptyColumn, true);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号