/** * Close the {@link #setDelegate(ResourceAwareItemReaderItemStream)} reader and reset instance variable values. */ @Override public void close() throws ItemStreamException { super.close(); if(!this.noInput) { delegate.close(); } noInput = false; }
/** * Use the delegate to read the next item, jump to next resource if current one is exhausted. Items are appended to * the buffer. * * @return next item from input */ private T readNextItem() throws Exception { T item = readFromDelegate(); while (item == null) { currentResource++; if (currentResource >= resources.length) { return null; } delegate.close(); delegate.setResource(resources[currentResource]); delegate.open(new ExecutionContext()); item = readFromDelegate(); } return item; }
@Override public void close() throws ItemStreamException { delegate.close(); }
/** * Close the {@link #setDelegate(ResourceAwareItemReaderItemStream)} reader and reset instance variable values. */ @Override public void close() throws ItemStreamException { super.close(); if(!this.noInput) { delegate.close(); } noInput = false; }
private Map<Long, T> readContent() throws Exception { Map<Long, T> result = new HashMap<>(); try { reader.open(executionContext); int i = 0; for (T item = reader.read(); item != null; item = reader.read()) { Long index = null; if (item instanceof ItemIndexAware) { index = ((ItemIndexAware) item).getIndex(); LOGGER.trace("Retrieving existing index={}", index); } if (index == null) { index = new Long(i++); LOGGER.trace("Setting new index={}", index); } result.put(index, item); LOGGER.debug("Read content : line={}, item={}", index, item); } } finally { reader.close(); } return result; }
@Override public T read() throws Exception { final Resource currentResource = resourceLocator.getResource(executionContext); if (previousResource == null || !previousResource.equals(currentResource)) { delegate.close(); delegate.setResource(currentResource); delegate.open(executionContext); previousResource = currentResource; } return delegate.read(); }
/** * Use the delegate to read the next item, jump to next resource if current one is exhausted. Items are appended to * the buffer. * * @return next item from input */ private T readNextItem() throws Exception { T item = readFromDelegate(); while (item == null) { currentResource++; if (currentResource >= resources.length) { return null; } delegate.close(); delegate.setResource(resources[currentResource]); delegate.open(new ExecutionContext()); item = readFromDelegate(); } return item; }