This commit is contained in:
Marten Deinum
2021-10-26 12:13:04 +02:00
parent 029d2d5394
commit 3f81bdb75c
2 changed files with 11 additions and 3 deletions

View File

@@ -39,7 +39,9 @@ public interface Sheet extends Iterable<String[]>, AutoCloseable {
String getName();
/**
* Get the row as a {@code String[]}. Returns {@code null} if the row doesn't exist.
* Get the row as a {@code String[]}. Returns {@code null} if the row doesn't exist. Can throw an {@code UnsupportedOperationException}
* when the underlying implementation doesn't support indexed access to rows.
*
* @param rowNumber the row number to read.
* @return a {@code String[]} or {@code null}
*/

View File

@@ -42,7 +42,13 @@ import org.springframework.batch.extensions.excel.Sheet;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.StaxUtils;
class StreamingSheet implements Sheet, Iterable<String[]>, Closeable {
/**
* {@code Sheet} implementation for Apache POI using the streaming event mode to read the rows.
*
* @author Marten Deinum
* @since 0.1.0
*/
class StreamingSheet implements Sheet {
private final Log logger = LogFactory.getLog(StreamingSheet.class);
@@ -143,7 +149,7 @@ class StreamingSheet implements Sheet, Iterable<String[]>, Closeable {
}
@Override
public void close() throws IOException {
public void close() throws Exception {
try {
this.reader.close();
}