List of usage examples for org.springframework.batch.item.xml.stax DefaultFragmentEventReader DefaultFragmentEventReader
public DefaultFragmentEventReader(XMLEventReader wrappedEventReader)
From source file:org.emonocot.job.io.StaxEventItemReader.java
/** * @throws Exception if there is a problem opening the resource *//*from w ww .j av a 2s. c om*/ protected final void doOpen() throws Exception { Assert.notNull(resource, "The Resource must not be null."); noInput = false; if (!resource.exists()) { if (strict) { throw new IllegalStateException("Input resource must exist" + " (reader is in 'strict' mode)"); } noInput = true; logger.warn("Input resource does not exist " + resource.getDescription()); return; } if (!resource.isReadable()) { if (strict) { throw new IllegalStateException( "Input resource must be readable" + " (reader is in 'strict' mode)"); } noInput = true; logger.warn("Input resource is not readable " + resource.getDescription()); return; } reader = new InputStreamReader(resource.getInputStream(), this.encoding); eventReader = XMLInputFactory.newInstance().createXMLEventReader(reader); fragmentReader = new DefaultFragmentEventReader(eventReader); }
From source file:org.geoserver.backuprestore.reader.CatalogFileReader.java
@Override protected void doOpen() throws Exception { Assert.notNull(resource, "The Resource must not be null."); try {//from ww w. ja v a 2s .c o m noInput = true; if (!resource.exists()) { if (strict) { throw new IllegalStateException("Input resource must exist (reader is in 'strict' mode)"); } logger.warn("Input resource does not exist " + resource.getDescription()); return; } if (!resource.isReadable()) { if (strict) { throw new IllegalStateException("Input resource must be readable (reader is in 'strict' mode)"); } logger.warn("Input resource is not readable " + resource.getDescription()); return; } inputStream = resource.getInputStream(); eventReader = XMLInputFactory.newInstance().createXMLEventReader(inputStream); fragmentReader = new DefaultFragmentEventReader(eventReader); noInput = false; } catch (Exception e) { logValidationExceptions((T) null, e); } }
From source file:org.springframework.batch.item.xml.StaxEventItemReader.java
@Override protected void doOpen() throws Exception { Assert.notNull(resource, "The Resource must not be null."); noInput = true;//from w w w. j a v a 2 s.co m if (!resource.exists()) { if (strict) { throw new IllegalStateException("Input resource must exist (reader is in 'strict' mode)"); } logger.warn("Input resource does not exist " + resource.getDescription()); return; } if (!resource.isReadable()) { if (strict) { throw new IllegalStateException("Input resource must be readable (reader is in 'strict' mode)"); } logger.warn("Input resource is not readable " + resource.getDescription()); return; } inputStream = resource.getInputStream(); eventReader = XMLInputFactory.newInstance().createXMLEventReader(inputStream); fragmentReader = new DefaultFragmentEventReader(eventReader); noInput = false; }