org.geotools.data.shapefile
Class ShapefileAttributeReader

Object
  extended by AbstractAttributeIO
      extended by ShapefileAttributeReader
All Implemented Interfaces:
AttributeReader
Direct Known Subclasses:
IndexedShapefileAttributeReader

public class ShapefileAttributeReader
extends AbstractAttributeIO
implements AttributeReader

An AttributeReader implementation for Shapefile. Pretty straightforward.
The default geometry is at position 0, and all dbf columns follow.
The dbf file may not be necessary, if not, just pass null as the DbaseFileReader


Field Summary
protected  DbaseFileReader dbf
           
protected  ShapefileReader.Record record
           
protected  DbaseFileReader.Row row
           
protected  ShapefileReader shp
           
 
Fields inherited from class AbstractAttributeIO
metaData
 
Constructor Summary
ShapefileAttributeReader(AttributeDescriptor[] atts, ShapefileReader shp, DbaseFileReader dbf)
          Create the shapefile reader
ShapefileAttributeReader(List<AttributeDescriptor> atts, ShapefileReader shp, DbaseFileReader dbf)
           
 
Method Summary
 void close()
          Release any resources associated with this reader
 boolean hasNext()
          Does another set of attributes exist in this reader?
 void next()
          Advance the reader to the next set of attributes.
 Object read(int param)
          Read the attribute at the given index.
 
Methods inherited from class AbstractAttributeIO
copy, getAttributeCount, getAttributeType
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface AttributeReader
getAttributeCount, getAttributeType
 

Field Detail

shp

protected ShapefileReader shp

dbf

protected DbaseFileReader dbf

row

protected DbaseFileReader.Row row

record

protected ShapefileReader.Record record
Constructor Detail

ShapefileAttributeReader

public ShapefileAttributeReader(List<AttributeDescriptor> atts,
                                ShapefileReader shp,
                                DbaseFileReader dbf)

ShapefileAttributeReader

public ShapefileAttributeReader(AttributeDescriptor[] atts,
                                ShapefileReader shp,
                                DbaseFileReader dbf)
Create the shapefile reader

Parameters:
atts - - the attributes that we are going to read.
shp - - the shapefile reader, required
dbf - - the dbf file reader. May be null, in this case no attributes will be read from the dbf file
Method Detail

close

public void close()
           throws IOException
Description copied from interface: AttributeReader
Release any resources associated with this reader

Specified by:
close in interface AttributeReader
Throws:
IOException

hasNext

public boolean hasNext()
                throws IOException
Description copied from interface: AttributeReader
Does another set of attributes exist in this reader?

Specified by:
hasNext in interface AttributeReader
Returns:
true if additional content exists for AttributeReader
Throws:
IOException

next

public void next()
          throws IOException
Description copied from interface: AttributeReader
Advance the reader to the next set of attributes.

Specified by:
next in interface AttributeReader
Throws:
IOException

read

public Object read(int param)
            throws IOException,
                   ArrayIndexOutOfBoundsException
Description copied from interface: AttributeReader
Read the attribute at the given index.

Specified by:
read in interface AttributeReader
Returns:
Object Attribute at given index
Throws:
IOException
ArrayIndexOutOfBoundsException


Copyright © 1996-2009 Geotools. All Rights Reserved.