Source Code Cross Referenced for TigerFeatureReader.java in  » GIS » GeoTools-2.4.1 » org » geotools » data » tiger » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.data.tiger 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2005-2006, Geotools Project Managment Committee (PMC)
005:         *    (C) 2003-2004, Julian J. Ray, All Rights Reserved
006:         *
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation; either
010:         *    version 2.1 of the License, or (at your option) any later version.
011:         *
012:         *    This library is distributed in the hope that it will be useful,
013:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *    Lesser General Public License for more details.
016:         */
017:        package org.geotools.data.tiger;
018:
019:        import java.io.File;
020:        import java.io.IOException;
021:        import java.util.NoSuchElementException;
022:
023:        import org.geotools.data.FeatureReader;
024:        import org.geotools.feature.Feature;
025:        import org.geotools.feature.FeatureType;
026:        import org.geotools.feature.IllegalAttributeException;
027:
028:        /**
029:         * <p>
030:         * Title: GeoTools2 Development
031:         * </p>
032:         * 
033:         * <p>
034:         * Description:
035:         * </p>
036:         * 
037:         * <p>
038:         * Copyright: Copyright (c) 2003
039:         * </p>
040:         * 
041:         * <p>
042:         * Company:
043:         * </p>
044:         *
045:         * @author Julian J. Ray
046:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/tiger/src/main/java/org/geotools/data/tiger/TigerFeatureReader.java $
047:         * @version 1.0
048:         */
049:        public class TigerFeatureReader implements  FeatureReader {
050:            /** DOCUMENT ME! */
051:            private TigerAttributeReader reader;
052:
053:            /** DOCUMENT ME! */
054:            private String namespace;
055:
056:            /** DOCUMENT ME! */
057:            private String typeName;
058:
059:            /**
060:             * Creates a new TigerFeatureReader object.
061:             *
062:             * @param dir DOCUMENT ME!
063:             * @param typeName DOCUMENT ME!
064:             *
065:             * @throws IOException DOCUMENT ME!
066:             */
067:            public TigerFeatureReader(File dir, String typeName)
068:                    throws IOException {
069:                // Typename contains both the file prefix and the subtype to be read
070:                this .namespace = typeName.substring(0, typeName.indexOf("_"));
071:                this .typeName = typeName.substring(typeName.indexOf("_") + 1);
072:
073:                // here we deal with case sensetivity. A little clumsy but what can you do... 
074:                // Try lower case extension first
075:                File file = new File(dir, this .namespace + ".rt1");
076:                if (!file.exists()) {
077:                    file = new File(dir, this .namespace + ".RT1");
078:                }
079:                if (!file.exists()) {
080:                    throw new IOException("Can't read RT1 file.");
081:                }
082:
083:                reader = new TigerAttributeReader(file, this .namespace,
084:                        this .typeName);
085:            }
086:
087:            /**
088:             * getFeatureType
089:             *
090:             * @return FeatureType
091:             */
092:            public FeatureType getFeatureType() {
093:                return reader.getFeatureType();
094:            }
095:
096:            /**
097:             * next
098:             *
099:             * @return Feature
100:             *
101:             * @throws IOException
102:             * @throws IllegalAttributeException
103:             * @throws NoSuchElementException
104:             */
105:            public Feature next() throws IOException,
106:                    IllegalAttributeException, NoSuchElementException {
107:                reader.next();
108:
109:                FeatureType type = reader.getFeatureType();
110:                String fid = reader.getFeatureID();
111:
112:                int numAtts = reader.getAttributeCount();
113:                Object[] values = new Object[numAtts];
114:
115:                for (int i = 0; i < numAtts; i++) {
116:                    values[i] = reader.read(i);
117:                }
118:
119:                return type.create(values, fid);
120:            }
121:
122:            /**
123:             * hasNext
124:             *
125:             * @return boolean
126:             *
127:             * @throws IOException
128:             */
129:            public boolean hasNext() throws IOException {
130:                return reader.hasNext();
131:            }
132:
133:            /**
134:             * close
135:             *
136:             * @throws IOException
137:             */
138:            public void close() throws IOException {
139:                reader.close();
140:                reader = null;
141:            }
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.