public class FileInJarReadableDataSource<T> extends AbstractDataSource<String,T>
A ReadableDataSource based on jar file. This class can only read file initially when it loads file.
Limitations: Default read buffer size is 1 MB, while max allowed buffer size is 4MB. File size should not exceed the buffer size, or exception will be thrown. Default charset is UTF-8.
parser, property| Constructor and Description |
|---|
FileInJarReadableDataSource(String jarName,
String fileInJarName,
Converter<String,T> configParser) |
FileInJarReadableDataSource(String jarName,
String fileInJarName,
Converter<String,T> configParser,
Charset charset) |
FileInJarReadableDataSource(String jarName,
String fileInJarName,
Converter<String,T> configParser,
int bufSize) |
FileInJarReadableDataSource(String jarName,
String fileInJarName,
Converter<String,T> configParser,
int bufSize,
Charset charset) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the data source.
|
String |
readSource()
Read original data from the data source.
|
getProperty, loadConfig, loadConfigpublic FileInJarReadableDataSource(String jarName, String fileInJarName, Converter<String,T> configParser) throws IOException
jarName - the jar to readfileInJarName - the file in jar to readconfigParser - the config decoder (parser)IOException - if IO failure occurspublic FileInJarReadableDataSource(String jarName, String fileInJarName, Converter<String,T> configParser, int bufSize) throws IOException
IOExceptionpublic FileInJarReadableDataSource(String jarName, String fileInJarName, Converter<String,T> configParser, Charset charset) throws IOException
IOExceptionpublic FileInJarReadableDataSource(String jarName, String fileInJarName, Converter<String,T> configParser, int bufSize, Charset charset) throws IOException
IOExceptionpublic String readSource() throws Exception
ReadableDataSourceException - IO or other error occurspublic void close()
throws Exception
ReadableDataSourceException - IO or other error occursCopyright © 2022 Alibaba Group. All rights reserved.