本文整理汇总了Java中org.beanio.BeanReader.close方法的典型用法代码示例。如果您正苦于以下问题:Java BeanReader.close方法的具体用法?Java BeanReader.close怎么用?Java BeanReader.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.beanio.BeanReader
的用法示例。
在下文中一共展示了BeanReader.close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIdentifyingRecords
import org.beanio.BeanReader; //导入方法依赖的package包/类
/**
* Tests that we can identify record types we're interested in, without breaking
*/
@Test
public void testIdentifyingRecords() {
StreamFactory factory = StreamFactory.newInstance();
factory.load(IGC_MAPPING_FILE);
BeanReader br = factory.createReader("igc_file", new File("src/test/resources/5c6c3ke1.igc"));;
boolean found_b_records = false;
try {
Object bean = null;
while ((bean = br.read()) != null) {
if (bean instanceof GNSSPointData) {
found_b_records = true;
}
}
} finally {
br.close();
}
assertEquals(true, found_b_records);
}
示例2: testPICNameParsing
import org.beanio.BeanReader; //导入方法依赖的package包/类
/**
* Test header record parsing by checking that the pilot name comes through correctly
*/
@Test
public void testPICNameParsing() {
StreamFactory factory = StreamFactory.newInstance();
factory.load(IGC_MAPPING_FILE);
BeanReader br = factory.createReader("igc_file", new File("src/test/resources/minimal_parsable.igc"));;
try {
Object bean = null;
while (!(bean instanceof PICName)) {
bean = br.read();
}
PICName pilot = (PICName) bean;
assertEquals("Kevin Mitchell", pilot.picName);
} finally {
br.close();
}
}
示例3: testFlightDateParsing
import org.beanio.BeanReader; //导入方法依赖的package包/类
@Test
public void testFlightDateParsing() throws ParseException {
StreamFactory factory = StreamFactory.newInstance();
factory.load(IGC_MAPPING_FILE);
BeanReader br = factory.createReader("igc_file", new File("src/test/resources/minimal_parsable.igc"));;
try {
Object bean = null;
while (!(bean instanceof FlightDate)) {
bean = br.read();
}
FlightDate fd = (FlightDate) bean;
assertEquals("2017-09-05", fd.getFlightDateString());
} finally {
br.close();
}
}
示例4: readModels
import org.beanio.BeanReader; //导入方法依赖的package包/类
private List<Object> readModels(Exchange exchange, InputStream stream) {
List<Object> results = new ArrayList<Object>();
BufferedReader streamReader = IOHelper.buffered(new InputStreamReader(stream, getEncoding()));
BeanReader in = factory.createReader(getStreamName(), streamReader);
try {
if (ObjectHelper.isNotEmpty(configuration.getBeanReaderErrorHandler())) {
in.setErrorHandler(configuration.getBeanReaderErrorHandler());
} else {
in.setErrorHandler(new BeanIOErrorHandler(configuration));
}
Object readObject;
while ((readObject = in.read()) != null) {
if (readObject instanceof BeanIOHeader) {
exchange.getOut().getHeaders().putAll(((BeanIOHeader) readObject).getHeaders());
}
results.add(readObject);
}
} finally {
in.close();
}
return results;
}