public class PropertyFeatureReader extends Object implements FeatureReader<SimpleFeatureType,SimpleFeature>
This implementation does not perform any filtering or processing; it leaves that up to wrappers to manipulate the content into the format or projection requested by the user.
The content of this file should start with a the property "_" with the value being the typeSpec describing the featureType. Thereafter each line will should have a FeatureID as the property and the attributes as the value separated by | characters.
_=id:Integer|name:String|geom:Geometry
fid1=1|Jody|well known text
fid2=2|Brent|well known text
fid3=3|Dave|well known text
Many values may be represented by a special tag:
. An empty element:
||
is interpreted as the empty string:
fid4=4|| -> Feature( id=2, name="", geom=null )
Constructor and Description |
---|
PropertyFeatureReader(String namespace,
File file) |
PropertyFeatureReader(String namespace,
File file,
GeometryFactory geometryFactory) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Be sure to call close when you are finished with this reader; as it must close the file it
has open.
|
SimpleFeatureType |
getFeatureType()
Return the FeatureType this reader has been configured to create.
|
boolean |
hasNext()
Check if additional content is available.
|
SimpleFeature |
next()
Grab the next feature from the property file.
|
Object |
read(int index)
Read attribute in position marked by
index . |
public PropertyFeatureReader(String namespace, File file) throws IOException
IOException
public PropertyFeatureReader(String namespace, File file, GeometryFactory geometryFactory) throws IOException
IOException
public SimpleFeatureType getFeatureType()
FeatureReader
getFeatureType
in interface FeatureReader<SimpleFeatureType,SimpleFeature>
public SimpleFeature next() throws IOException, NoSuchElementException
next
in interface FeatureReader<SimpleFeatureType,SimpleFeature>
IOException
NoSuchElementException
- Check hasNext() to avoid reading off the end of the filepublic Object read(int index) throws IOException, ArrayIndexOutOfBoundsException
index
.index
- Attribute position to readindex
IOException
ArrayIndexOutOfBoundsException
public boolean hasNext() throws IOException
hasNext
in interface FeatureReader<SimpleFeatureType,SimpleFeature>
true
if additional content is availableIOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface FeatureReader<SimpleFeatureType,SimpleFeature>
IOException
Copyright © 1996–2019 Geotools. All rights reserved.