org.geotools.data.property
Class PropertyAttributeWriter

java.lang.Object
  extended byorg.geotools.data.property.PropertyAttributeWriter
All Implemented Interfaces:
AttributeWriter

public class PropertyAttributeWriter
extends java.lang.Object
implements AttributeWriter

Simple AttributeWriter that produces Java properties files.

This AttributeWriter is part of the geotools2 DataStore tutorial, and should be considered a Toy.

The content produced witll start with the property "_" with the value being the typeSpec describing the featureType. Thereafter each line will represent a Features with 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
 

Author:
jgarnett

Constructor Summary
PropertyAttributeWriter(java.io.File file, FeatureType featureType)
           
 
Method Summary
 void close()
           
 void echoLine(java.lang.String line)
           
 int getAttributeCount()
          The number of attributes this reader can read, i.e the length of a row.
 AttributeType getAttributeType(int index)
          Retrieve the AttributeType at the given index.
 boolean hasNext()
          Query whether there are other rows in the attribute writer.
 void next()
          Advance the AttributeWriter, all calls to write will correspond to the same set of attributes until next is called again.
 void write(int position, java.lang.Object attribute)
          Write the given attribute value at the position indicated.
 void writeFeatureID(java.lang.String fid)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyAttributeWriter

public PropertyAttributeWriter(java.io.File file,
                               FeatureType featureType)
                        throws java.io.IOException
Method Detail

getAttributeCount

public int getAttributeCount()
Description copied from interface: AttributeWriter
The number of attributes this reader can read, i.e the length of a row.

Specified by:
getAttributeCount in interface AttributeWriter

getAttributeType

public AttributeType getAttributeType(int index)
                               throws java.lang.ArrayIndexOutOfBoundsException
Description copied from interface: AttributeWriter
Retrieve the AttributeType at the given index.

Specified by:
getAttributeType in interface AttributeWriter
Throws:
java.lang.ArrayIndexOutOfBoundsException

hasNext

public boolean hasNext()
                throws java.io.IOException
Description copied from interface: AttributeWriter
Query whether there are other rows in the attribute writer.

Specified by:
hasNext in interface AttributeWriter
Returns:
Throws:
java.io.IOException
See Also:
FeatureWriter.hasNext()

next

public void next()
          throws java.io.IOException
Description copied from interface: AttributeWriter
Advance the AttributeWriter, all calls to write will correspond to the same set of attributes until next is called again.

Specified by:
next in interface AttributeWriter
Throws:
java.io.IOException

echoLine

public void echoLine(java.lang.String line)
              throws java.io.IOException
Throws:
java.io.IOException

writeFeatureID

public void writeFeatureID(java.lang.String fid)
                    throws java.io.IOException
Throws:
java.io.IOException

write

public void write(int position,
                  java.lang.Object attribute)
           throws java.io.IOException
Description copied from interface: AttributeWriter
Write the given attribute value at the position indicated. Implementations can choose to immediately flush the write or buffer it.

Specified by:
write in interface AttributeWriter
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface AttributeWriter
Throws:
java.io.IOException


Copyright © GeoTools. All Rights Reserved.