/** * Reads the next item, jumping to next resource if necessary. */ @Override public T read() throws Exception, UnexpectedInputException, ParseException { if (noInput) { return null; } // If there is no resource, then this is the first item, set the current // resource to 0 and open the first delegate. if (currentResource == -1) { currentResource = 0; delegate.setResource(resources[currentResource]); delegate.open(new ExecutionContext()); } return readNextItem(); }
delegate.setResource(resources[currentResource]); delegate.open(executionContext);
/** * 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; }
private void initializeStreams() throws Exception { if (createBackupFile) { outputResource = new FileSystemResource(File.createTempFile(resource.getFilename(), ".tmp", resource.getFile().getParentFile())); } else { outputResource = resource; } reader.setResource(resource); writer.setResource(outputResource); }
@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(); }
/** * Reads the next item, jumping to next resource if necessary. */ @Override public T read() throws Exception, UnexpectedInputException, ParseException { if (noInput) { return null; } // If there is no resource, then this is the first item, set the current // resource to 0 and open the first delegate. if (currentResource == -1) { currentResource = 0; delegate.setResource(resources[currentResource]); delegate.open(new ExecutionContext()); } return readNextItem(); }
delegate.setResource(resources[currentResource]); delegate.open(executionContext);
/** * 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; }