public class ExcelReader extends Object implements AutoCloseable
try (ExcelReader reader = ExcelReader.read(path)) {
reader.sheets().flatMap(Sheet::rows).forEach(System.out::println);
} catch (IOException e) {}
Create by guanquan.wang on 2018-09-22| 限定符 | 构造器和说明 |
|---|---|
protected |
ExcelReader() |
| 限定符和类型 | 方法和说明 |
|---|---|
Sheet[] |
all()
get all sheets
|
void |
close()
close stream and delete temp files
|
AppInfo |
getAppInfo()
General information like title,subject and creator
|
protected AppInfo |
getGeneralInfo() |
int |
getSize()
size of sheets
|
ExcelType |
getType()
Type of excel
|
static ExcelReader |
read(InputStream stream)
Constructor Excel Reader
|
static ExcelReader |
read(InputStream stream,
int bufferSize)
Constructor Excel Reader
|
static ExcelReader |
read(InputStream stream,
int bufferSize,
int cacheSize)
Constructor Excel Reader
|
static ExcelReader |
read(Path path)
Constructor Excel Reader
|
static ExcelReader |
read(Path path,
int bufferSize)
Constructor Excel Reader
|
static ExcelReader |
read(Path path,
int bufferSize,
int cacheSize)
Constructor Excel Reader
|
Sheet |
sheet(int index)
get by index
|
Sheet |
sheet(String sheetName)
get by name
|
Stream<Sheet> |
sheets()
to streams
|
public static ExcelReader read(Path path) throws IOException
path - the excel pathExcelReaderIOException - if path not exists or I/O error occurpublic static ExcelReader read(InputStream stream) throws IOException
stream - the InputStream of excelExcelReaderIOException - if I/O error occurpublic static ExcelReader read(Path path, int bufferSize) throws IOException
path - the excel pathbufferSize - the SharedStrings buffer size. default is 512
This parameter affects the number of read times.ExcelReaderIOException - if path not exists or I/O error occurpublic static ExcelReader read(InputStream stream, int bufferSize) throws IOException
stream - the InputStream of excelbufferSize - the SharedStrings buffer size. default is 512
This parameter affects the number of read times.ExcelReaderIOException - if I/O error occurpublic static ExcelReader read(Path path, int bufferSize, int cacheSize) throws IOException
path - the excel pathbufferSize - the SharedStrings buffer size. default is 512
This parameter affects the number of read times.cacheSize - the Cache size, default is 512ExcelReaderIOException - if path not exists or I/O error occurpublic static ExcelReader read(InputStream stream, int bufferSize, int cacheSize) throws IOException
stream - the InputStream of excelbufferSize - the SharedStrings buffer size. default is 512
This parameter affects the number of read times.cacheSize - the Cache size, default is 512ExcelReaderIOException - if I/O error occurpublic ExcelType getType()
public Sheet sheet(int index)
index - sheet index of workbookpublic Sheet[] all()
public int getSize()
public void close()
throws IOException
close 在接口中 AutoCloseableIOException - when fail close readerspublic AppInfo getAppInfo()
protected AppInfo getGeneralInfo()
Copyright © 2019. All rights reserved.