Java Doc for MIFFile.java in  » GIS » GeoTools-2.4.1 » org » geotools » data » mif » 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.mif 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.data.mif.MIFFile

MIFFile
public class MIFFile (Code)

MIFFile class allows sequential reading and writing of Features in MapInfo MIF/MID text file format with a FeatureReader and FeatureWriter.

This class has been developed starting from MapInfoDataSource.

Open issues:

  • CoordSys clause parsing is still not supported

author:
   Luca S. Percich, AMA-MI
author:
   Paolo Rizzi, AMA-MI
version:
   $Id: MIFFile.java 27862 2007-11-12 19:51:19Z desruisseaux $


Field Summary
final public static  intMAX_STRING_LEN
    

Constructor Summary
public  MIFFile(String path, Map params)
    

This constructor opens an existing MIF/MID file, and creates the corresponding schema from the file header

Allowed parameters in params Map:

  • "namespace" = URI of the namespace prefix for FeatureTypes
  • PARAM_GEOMFACTORY = GeometryFactory object to be used for creating geometries; alternatively, use PARAM_SRID;
  • PARAM_SRID = SRID to be used for creating geometries;
  • PARAM_FIELDCASE = field names tranformation: "upper" to uppercase | "lower" to lowercase | "" none;
  • PARAM_GEOMNAME = <String>, name of the geometry field (defaults to "the_geom");
  • PARAM_GEOMTYPE = geometry type handling: "untyped" uses Geometry class | "typed" force geometry to the type of the first valid geometry found in file | "multi" like typed, but forces LineString to MultilineString and Polygon to MultiPolygon; | "Point" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon" | "Text" forces Geometry to Point and creates a MIF_TEXT String field in the schema

Header clauses values can also be set in the params Map, but they might be overridden by values read from MIF header.

public  MIFFile(String path, FeatureType featureType, HashMap params)
    

This constructor creates a a new MIF/MID file given schema and path.


Method Summary
protected static  voidcopyFileAndDelete(File in, File out, boolean deleteIn)
    
public  FeatureReadergetFeatureReader()
    

Opens the MIF file for input and returns a FeatureReader for accessing the features.

TODO Concurrent file access is still not handled.

public  FeatureWritergetFeatureWriter()
     Returns a FeatureWriter for writing features to the MIF/MID file.
protected static  FilegetFileHandler(File path, String fileName, String ext, boolean mustExist)
    
public  StringgetHeaderClause(String clause)
    
protected static  StringgetMifName(String fName)
    
public  FeatureTypegetSchema()
    

Field Detail
MAX_STRING_LEN
final public static int MAX_STRING_LEN(Code)




Constructor Detail
MIFFile
public MIFFile(String path, Map params) throws IOException(Code)

This constructor opens an existing MIF/MID file, and creates the corresponding schema from the file header

Allowed parameters in params Map:

  • "namespace" = URI of the namespace prefix for FeatureTypes
  • PARAM_GEOMFACTORY = GeometryFactory object to be used for creating geometries; alternatively, use PARAM_SRID;
  • PARAM_SRID = SRID to be used for creating geometries;
  • PARAM_FIELDCASE = field names tranformation: "upper" to uppercase | "lower" to lowercase | "" none;
  • PARAM_GEOMNAME = <String>, name of the geometry field (defaults to "the_geom");
  • PARAM_GEOMTYPE = geometry type handling: "untyped" uses Geometry class | "typed" force geometry to the type of the first valid geometry found in file | "multi" like typed, but forces LineString to MultilineString and Polygon to MultiPolygon; | "Point" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon" | "Text" forces Geometry to Point and creates a MIF_TEXT String field in the schema

Header clauses values can also be set in the params Map, but they might be overridden by values read from MIF header.

Basic usage:


 HashMap params = new HashMap();
 // params.put(MIFFile.PARAM_GEOMFACTORY, new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING_SINGLE), SRID));
 params.put(MIFFile.PARAM_SRID, new Integer(SRID));
 params.put(MIFFile.PARAM_FIELDCASE, "upper");
 params.put(MIFFile.PARAM_GEOMNAME, "GEOM");
 params.put(MIFFile.PARAM_GEOMTYPE, "typed");
 MIFFile mf = new MIFFile("c:/some_path/file.mif",params);
 FeatureType ft = mf.getSchema();
 FeatureReader fr = mf.getFeatureReader();	
 while (fr.hasNext()) {
 Feature in = fr.next();
 doSomethingWithFeature(in);
 }
 fr.close(); // closes file resources
 

Parameters:
  path - Full pathName of the mif file, can be specified without the.mif extension
Parameters:
  params - Parameters map
throws:
  IOException - If the specified mif file could not be opened



MIFFile
public MIFFile(String path, FeatureType featureType, HashMap params) throws IOException, SchemaException(Code)

This constructor creates a a new MIF/MID file given schema and path. If a .mif/.mid file pair already exists, it will be overwritten.

Basic usage:


 HashMap params = new HashMap();
 params.put(MIFFile.MIFDataStore.HCLAUSE_COORDSYS, "Nonearth \"m\"");
 MIFFile mf = new MIFFile("c:/some_path/", ft, params);
 FeatureWriter fw = mf.getFeatureWriter();
 while(...) {
 Feature f = fw.next();
 f.setAttribute(...,...);
 fw.write();
 }
 fw.close();
 

Parameters:
  path - Full path & file name of the MIF file to create, can bespecified without the .mif extension
Parameters:
  featureType -
Parameters:
  params - Parameter map
throws:
  IOException - Couldn't open the specified mif file for writingheader
throws:
  SchemaException - Error setting the given FeatureType as the MIFschema




Method Detail
copyFileAndDelete
protected static void copyFileAndDelete(File in, File out, boolean deleteIn) throws IOException(Code)
Utility function for copying or moving files
Parameters:
  in - Source file
Parameters:
  out - Destination file
Parameters:
  deleteIn - If true, source will be deleted upon successfull copy
throws:
  IOException -



getFeatureReader
public FeatureReader getFeatureReader() throws IOException(Code)

Opens the MIF file for input and returns a FeatureReader for accessing the features.

TODO Concurrent file access is still not handled. MUST LOCK FILE and return an error if another FeatureReader is open - Handle concurrent access with synchronized(mif) / or Filesystem locking is enough?

A FeatureReader for reading features from MIF/MID file
throws:
  IOException -



getFeatureWriter
public FeatureWriter getFeatureWriter() throws IOException(Code)
Returns a FeatureWriter for writing features to the MIF/MID file. A featureWriter for this file
throws:
  IOException -



getFileHandler
protected static File getFileHandler(File path, String fileName, String ext, boolean mustExist) throws FileNotFoundException(Code)
Utility function for initFiles - returns a File given a parent path, the file name without extension and the extension Tests different extension case for case-sensitive filesystems
Parameters:
  path - Directory containing the file
Parameters:
  fileName - Name of the file with no extension
Parameters:
  ext - extension with trailing "."
Parameters:
  mustExist - If true, raises an excaption if the file does not exist The File object
throws:
  FileNotFoundException -



getHeaderClause
public String getHeaderClause(String clause)(Code)
Gets the value for an header clause
Parameters:
  clause -



getMifName
protected static String getMifName(String fName) throws FileNotFoundException(Code)
Returns the name of a .mif file without extension
Parameters:
  fName - The file name, possibly with .mif extension The name with no extension
throws:
  FileNotFoundException - if extension was other than "mif"



getSchema
public FeatureType getSchema()(Code)
Returns the MIF schema the current FeatureType associated with the MIF file



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.