@Override public int count() { int i = 0; for ( @SuppressWarnings("unused") Feature f : this ) { i++; } close(); return i; } }
@SuppressWarnings("unchecked") public Iterator<T> getMembers() { if ( fc != null ) { return (Iterator<T>) fc.iterator(); } return new Iterator<T>() { @Override public boolean hasNext() { return xmlStream.isStartElement() && WFS200_MEMBER.equals( xmlStream.getName() ); } @Override public T next() { if ( !hasNext() ) { throw new NoSuchElementException(); } T value = null; try { value = parse200MemberProperty(); } catch ( Throwable t ) { throw new RuntimeException( t.getMessage(), t ); } return value; } @Override public void remove() { throw new UnsupportedOperationException(); } }; }
@Override public Feature next() { if ( next == null ) { throw new NoSuchElementException(); } Feature currentFeature = next; try { next = read(); } catch ( IOException e ) { throw new RuntimeException(); } return currentFeature; }
public Feature read() throws IOException { Feature feature = null; try { while ( feature == null && xmlStream.getEventType() != END_ELEMENT ) { if ( featureArrayMode ) { feature = readFeatureArray(); } else { feature = readProperty(); } } } catch ( Exception e ) { e.printStackTrace(); throw new IOException( e.getMessage(), e ); } return feature; }
/** * Returns a {@link StreamFeatureCollection} that allows stream-based access to the members of the feature * collection that the cursor of the given <code>XMLStreamReader</code> points at. * * @param xmlStream * cursor must point at the <code>START_ELEMENT</code> event of a feature collection element * @param crs * default CRS for all descendant geometry properties, can be <code>null</code> * @return * @throws XMLStreamException */ public StreamFeatureCollection getFeatureStream( XMLStreamReaderWrapper xmlStream, ICRS crs ) throws XMLStreamException { if ( schema == null ) { schema = buildAppSchema( xmlStream ); gmlStreamReader.setApplicationSchema( schema ); } String fid = parseFeatureId( xmlStream ); QName featureName = xmlStream.getName(); FeatureCollectionType ft = (FeatureCollectionType) lookupFeatureType( xmlStream, featureName, true ); return new StreamFeatureCollection( fid, ft, this, xmlStream, crs ); }
final Feature nextFeature; try { nextFeature = read(); } catch ( IOException e ) { throw new RuntimeException();