/** * Default implementation based on creating an reader, testing hasNext, and closing. * * <p>For once the Collections API does not give us an escape route, we *have* to check the * data. */ public boolean isEmpty() { FeatureReader<SimpleFeatureType, SimpleFeature> reader = null; try { reader = reader(); try { return !reader.hasNext(); } catch (IOException e) { return true; // error seems like no features are available } } catch (IOException e) { return true; } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { // return value already set } } } }
reader = reader(); try { while (reader.hasNext()) {
/** * Returns a FeatureWriterIterator, or FeatureReaderIterator over content. * * <p>If you have a way to tell that you are readonly please subclass with a less hardcore check * - this implementations catches a UnsupportedOpperationsException from wrtier()! * * @return Iterator, should be closed closeIterator */ protected Iterator<SimpleFeature> openIterator() throws IOException { try { FeatureWriter writer = writer(); if (writer != null) { return new FeatureWriterIterator(writer()); } } catch (IOException badWriter) { return new NoContentIterator(badWriter); } catch (UnsupportedOperationException readOnly) { } try { return new FeatureReaderIterator(reader()); } catch (IOException e) { return new NoContentIterator(e); } }
/** * Default implementation based on creating an reader, testing hasNext, and closing. * <p> * For once the Collections API does not give us an escape route, we *have* to check the data. * </p> */ public boolean isEmpty() { FeatureReader<SimpleFeatureType, SimpleFeature> reader = null; try { reader = reader(); try { return !reader.hasNext(); } catch (IOException e) { return true; // error seems like no features are available } } catch (IOException e) { return true; } finally { if( reader != null ){ try { reader.close(); } catch (IOException e) { // return value already set } } } }
/** * Default implementation based on creating an reader, testing hasNext, and closing. * <p> * For once the Collections API does not give us an escape route, we *have* to check the data. * </p> */ public boolean isEmpty() { FeatureReader reader = null; try { reader = reader(); try { return !reader.hasNext(); } catch (IOException e) { return true; // error seems like no features are available } } catch (IOException e) { return true; } finally { if( reader != null ){ try { reader.close(); } catch (IOException e) { // return value already set } } } }
FeatureReader reader = null; try { reader = reader(); FeatureType schema = getSchema();
reader = reader(); try { while( reader.hasNext() ){
reader = reader(); try { while( reader.hasNext() ){
/** * Returns a FeatureWriterIterator, or FeatureReaderIterator over content. * <p> * If you have a way to tell that you are readonly please subclass with * a less hardcore check - this implementations catches a * UnsupportedOpperationsException from wrtier()! * * @return Iterator, should be closed closeIterator */ protected Iterator openIterator() throws IOException { try { return new FeatureWriterIterator( writer() ); } catch (IOException badWriter) { return new NoContentIterator( badWriter ); } catch( UnsupportedOperationException readOnly ){ } try { return new FeatureReaderIterator( reader() ); } catch (IOException e) { return new NoContentIterator( e ); } }
/** * Returns a FeatureWriterIterator, or FeatureReaderIterator over content. * <p> * If you have a way to tell that you are readonly please subclass with * a less hardcore check - this implementations catches a * UnsupportedOpperationsException from wrtier()! * * @return Iterator, should be closed closeIterator */ protected Iterator<SimpleFeature> openIterator() throws IOException { try { FeatureWriter writer = writer(); if(writer != null) { return new FeatureWriterIterator( writer() ); } } catch (IOException badWriter) { return new NoContentIterator( badWriter ); } catch( UnsupportedOperationException readOnly ){ } try { return new FeatureReaderIterator( reader() ); } catch (IOException e) { return new NoContentIterator( e ); } }