01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * Created on Aug 3, 2004
17: */
18: package org.geotools.data.vpf.file;
19:
20: import java.io.IOException;
21: import java.util.NoSuchElementException;
22:
23: import org.geotools.data.FeatureReader;
24: import org.geotools.feature.Feature;
25: import org.geotools.feature.FeatureType;
26: import org.geotools.feature.IllegalAttributeException;
27:
28: /**
29: * A feature reader for the VPFFile object
30: *
31: * @author <a href="mailto:jeff@ionicenterprise.com">Jeff Yutzler</a>
32: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/vpf/src/main/java/org/geotools/data/vpf/file/VPFFileFeatureReader.java $
33: */
34: public class VPFFileFeatureReader implements FeatureReader {
35: private final VPFFile featureType;
36: private Feature currentFeature;
37:
38: public VPFFileFeatureReader(VPFFile type) {
39: featureType = type;
40: currentFeature = null;
41:
42: featureType.reset();
43: }
44:
45: /* (non-Javadoc)
46: * @see org.geotools.data.FeatureReader#getFeatureType()
47: */
48: public FeatureType getFeatureType() {
49: return featureType;
50: }
51:
52: /* (non-Javadoc)
53: * @see org.geotools.data.FeatureReader#next()
54: */
55: public Feature next() throws IOException,
56: IllegalAttributeException, NoSuchElementException {
57: if (!hasNext()) {
58: throw new NoSuchElementException();
59: }
60: currentFeature = featureType.readFeature();
61:
62: return currentFeature;
63: }
64:
65: /* (non-Javadoc)
66: * @see org.geotools.data.FeatureReader#hasNext()
67: */
68: public boolean hasNext() throws IOException {
69: boolean result = false;
70:
71: // Ask the stream if it has space for another object
72: result = featureType.hasNext();
73: return result;
74: }
75:
76: /* (non-Javadoc)
77: * @see org.geotools.data.FeatureReader#close()
78: */
79: public void close() throws IOException {
80: // TODO Auto-generated method stub
81: }
82: }
|