|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectPropertyAttributeReader
public class PropertyAttributeReader
Simple AttributeReader that works against Java properties files.
This AttributeReader is part of the GeoTools AbstractDataStore tutorial, and should be considered a Toy.
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 attribtues 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
May values may be represented by a special tag:
. An empty element:
||
is interpreted as the empty string:
fid4=4||
You can use \ to escape a | character, you can also use it to protect newlines::
fid4=4|I have a \\|splitting\\| headache|POINT(0,0) fid5=5|Example of \nmulti-lin text|POINT(1,1) fid6=6|Second \\ example of multi-line text|POINT(2,2)
Constructor Summary | |
---|---|
PropertyAttributeReader(File file)
Creates a new PropertyAttributeReader object. |
Method Summary | |
---|---|
void |
close()
Close the internal reader accessing the file. |
int |
getAttributeCount()
Number of attributes to expect based on header information. |
AttributeDescriptor |
getAttributeType(int index)
AttribtueDescriptor (name and type) for position marked by index. |
String |
getFeatureID()
Retrieve the FeatureId identifying the current line. |
boolean |
hasNext()
Check if the file has another line. |
void |
next()
Retrieve the next line. |
Object |
read(int index)
Read attribute in position marked by index . |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertyAttributeReader(File file) throws IOException
file
- File being read
IOException
DataSourceException
Method Detail |
---|
public int getAttributeCount()
getAttributeCount
in interface AttributeReader
public AttributeDescriptor getAttributeType(int index) throws ArrayIndexOutOfBoundsException
getAttributeType
in interface AttributeReader
index
-
ArrayIndexOutOfBoundsException
public void close() throws IOException
close
in interface AttributeReader
IOException
public boolean hasNext() throws IOException
hasNext
in interface AttributeReader
true
if the file has another line
IOException
public void next() throws IOException
next
in interface AttributeReader
IOException
NoSuchElementException
public String getFeatureID()
public Object read(int index) throws IOException, ArrayIndexOutOfBoundsException
index
.
read
in interface AttributeReader
index
- Attribute position to read
index
IOException
ArrayIndexOutOfBoundsException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |