Source Code Cross Referenced for TableHeader.java in  » GIS » GeoTools-2.4.1 » org » geotools » data » vpf » io » 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.vpf.io 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2003-2006, Geotools Project Managment Committee (PMC)
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation; either
009:         *    version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         */
016:        package org.geotools.data.vpf.io;
017:
018:        import java.util.Collections;
019:        import java.util.List;
020:
021:        import org.geotools.data.vpf.ifc.DataTypesDefinition;
022:        import org.geotools.data.vpf.ifc.VPFHeader;
023:
024:        /**
025:         * This class contains definition of VPF standard table header according to
026:         * specification found in: "Interface Standard for Vector Product Format."
027:         * Objects of this type are immutable.  Created: Thu Jan 02 22:50:59 2003
028:         *
029:         * @author <a href="mailto:kobit@users.fs.net">Artur Hefczyc</a>
030:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/vpf/src/main/java/org/geotools/data/vpf/io/TableHeader.java $
031:         * @version 1.0
032:         */
033:        public class TableHeader implements  VPFHeader, DataTypesDefinition {
034:            /**
035:             * Variable <code>length</code> keeps value of length of ASCII header
036:             * string (i.e., the remaining information after this field)
037:             */
038:            private int headerLength = -0;
039:
040:            /**
041:             * Variable <code>byteOrder</code> keeps value of  byte order in which
042:             * table is written:
043:             * 
044:             * <ul>
045:             * <li>
046:             * <b>L</b> - least-significant-first
047:             * </li>
048:             * <li>
049:             * <b>M</b> - most-significant-first
050:             * </li>
051:             * </ul>
052:             */
053:            private char byteOrder = LEAST_SIGNIF_FIRST;
054:
055:            /**
056:             * Variable <code>description</code> keeps value of text description of the
057:             * table's contents.
058:             */
059:            private String description = null;
060:
061:            /**
062:             * Variable <code>narrativeTable</code> keeps value of  an optional
063:             * narrative file which contains miscellaneous information about the
064:             * table.
065:             */
066:            private String narrativeTable = null;
067:
068:            /**
069:             * Variable <code>columnDefs</code> keeps value of list of all column
070:             * definitions found in table header. This list keeps objects of type
071:             * <code>TableColumnDef</code> class.
072:             */
073:            private List columnDefs = null;
074:
075:            /**
076:             * Creates a new <code>TableHeader</code> instance.
077:             *
078:             * @param length an <code>int</code> value of table header length.
079:             * @param byteOrder a <code>char</code> value byte order used in table
080:             *        file.
081:             * @param description a <code>String</code> value text description of found
082:             *        in header of this table.
083:             * @param narrativeTable a <code>String</code> value file name of narrative
084:             *        table.
085:             * @param columnDefs a <code>List</code> value of all column definitions
086:             *        for this table.
087:             */
088:            public TableHeader(int length, char byteOrder, String description,
089:                    String narrativeTable, List columnDefs) {
090:                this .headerLength = length;
091:                this .byteOrder = byteOrder;
092:                this .description = description;
093:                this .narrativeTable = narrativeTable;
094:                this .columnDefs = columnDefs;
095:            }
096:
097:            /**
098:             * Method <code>toString</code> returns content of all fields values. Used
099:             * only for test and debug purpose.
100:             *
101:             * @return a <code>String</code> value
102:             */
103:            public String toString() {
104:                String endLine = System.getProperty("line.separator");
105:                StringBuffer buff = new StringBuffer();
106:                buff.append(" length=" + headerLength + endLine);
107:                buff.append(" byteOrder=" + byteOrder + endLine);
108:                buff.append(" description=" + description + endLine);
109:                buff.append(" narrativeTable=" + narrativeTable + endLine);
110:                buff.append(" columnDefs:");
111:
112:                if (columnDefs == null) {
113:                    buff.append("null)");
114:                } else {
115:                    for (int i = 0; i < columnDefs.size(); i++) {
116:                        buff.append(endLine + columnDefs.get(i).toString());
117:                    }
118:
119:                    buff.append(endLine);
120:                }
121:
122:                return buff.toString();
123:            }
124:
125:            /**
126:             * Gets the value of full length of ASCII header string including
127:             * <code>headerLength</code> field.
128:             *
129:             * @return the value of headerLength
130:             */
131:            public int getLength() {
132:                return this .headerLength + 4;
133:            }
134:
135:            /**
136:             * Method <code><code>getRecordSize</code></code> is used to return size in
137:             * bytes of records stored in this table. If table keeps variable length
138:             * records <code>-1</code> should be returned.
139:             *
140:             * @return an <code><code>int</code></code> value
141:             */
142:            public int getRecordSize() {
143:                int size = 0;
144:
145:                for (int i = 0; i < columnDefs.size(); i++) {
146:                    TableColumnDef colDef = (TableColumnDef) columnDefs.get(i);
147:
148:                    //       System.out.println("Column def no. "+i+" column size: "+
149:                    //                          colDef.getColumnSize());
150:                    if (colDef.getColumnSize() < 0) {
151:                        return -1;
152:                    } else {
153:                        size += colDef.getColumnSize();
154:                    }
155:                }
156:
157:                return size;
158:            }
159:
160:            /**
161:             * Gets the value of byteOrder variable. Byte order in which table is
162:             * written:
163:             * 
164:             * <ul>
165:             * <li>
166:             * <b>L</b> - least-significant-first
167:             * </li>
168:             * <li>
169:             * <b>M</b> - most-significant-first
170:             * </li>
171:             * </ul>
172:             * 
173:             *
174:             * @return the value of byteOrder
175:             */
176:            public char getByteOrder() {
177:                return this .byteOrder;
178:            }
179:
180:            /**
181:             * Gets the value of the description of table content.
182:             *
183:             * @return the value of description
184:             */
185:            public String getDescription() {
186:                return this .description;
187:            }
188:
189:            /**
190:             * Gets the value of narrativeTable variable file name.
191:             *
192:             * @return the value of narrativeTable
193:             */
194:            public String getNarrativeTable() {
195:                return this .narrativeTable;
196:            }
197:
198:            /**
199:             * Gets the value of columnDefs variable keeping definitions of all columns
200:             * in this table.
201:             *
202:             * @return the value of columnDefs
203:             */
204:            public List getColumnDefs() {
205:                return Collections.unmodifiableList(this .columnDefs);
206:            }
207:        }
208:
209:        // TableHeader
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.