/** * Next Feature from reader or new content. * * @see org.geotools.data.FeatureWriter#next() */ public SimpleFeature next() throws IOException { SimpleFeatureType type = getFeatureType(); if (hasNext()) { // hasNext() will take care recording // any modifications to current live = next; // update live value next = null; // hasNext will need to search again current = SimpleFeatureBuilder.copy(live); return current; } else { if (diff == null) { throw new IOException("FeatureWriter has been closed"); } // Create new content // created with an empty ID // (The real writer will supply a FID later) live = null; next = null; current = builder.buildFeature( "new" + diff.nextFID, new Object[type.getAttributeCount()]); diff.nextFID++; return current; } }
/** * Next Feature from reader or new content. * * @see org.geotools.data.FeatureWriter#next() */ public SimpleFeature next() throws IOException { SimpleFeatureType type = getFeatureType(); if (hasNext()) { // hasNext() will take care recording // any modifications to current live = next; // update live value next = null; // hasNext will need to search again current = SimpleFeatureBuilder.copy(live); return current; } else { // Create new content // created with an empty ID // (The real writer will supply a FID later) live = null; next = null; current = SimpleFeatureBuilder.build(type, new Object[type.getAttributeCount()], "new"+ diff.nextFID); diff.nextFID++; return current; } }