01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-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;
09: * version 2.1 of the License.
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: package org.geotools.data;
17:
18: import java.io.IOException;
19:
20: /** - Added hasNext to support the FeatureWriter API.
21: * - Changed order of writer parameters to match Collections, JDBC API.
22: * - Added IOExceptions on all methods.
23: * - Do we want AttributeWriters to know about the schema and perform
24: * validation??
25: *
26: *
27: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/data/AttributeWriter.java $
28: * @version $Id: AttributeWriter.java 22266 2006-10-19 11:30:55Z acuster $
29: * @author Ian Schneider
30: * @author Sean Geoghegan, Defence Science and Technology Organisation.
31: */
32: public interface AttributeWriter {
33: /**
34: * The number of attributes this reader can read, i.e the length of a row.
35: */
36: int getAttributeCount();
37:
38: /**
39: * Retrieve the AttributeType at the given index.
40: */
41: org.geotools.feature.AttributeType getAttributeType(int i)
42: throws ArrayIndexOutOfBoundsException;
43:
44: /**
45: * Advance the AttributeWriter, all calls to write will correspond to the
46: * same set of attributes until next is called again.
47: */
48: void next() throws IOException;
49:
50: /**
51: * Write the given attribute value at the position indicated.
52: * Implementations can choose to immediately flush the write or buffer it.
53: */
54: void write(int position, Object attribute) throws IOException;
55:
56: void close() throws IOException;
57:
58: /** Query whether there are other rows in the attribute writer.
59: *
60: * @throws IOException
61: * @see FeatureWriter#hasNext()
62: */
63: boolean hasNext() throws IOException;
64:
65: }
|