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


org.geotools.data.AbstractFileDataStore
   org.geotools.data.shapefile.ShapefileDataStore

All known Subclasses:   org.geotools.data.shapefile.indexed.IndexedShapefileDataStore,
ShapefileDataStore
public class ShapefileDataStore extends AbstractFileDataStore (Code)
A DataStore implementation which allows reading and writing from Shapefiles.
author:
   Ian Schneider

Inner Class :protected static class Reader extends AbstractAttributeIO implements AttributeReader
Inner Class :protected class Writer implements FeatureWriter

Field Summary
final public static  CharsetDEFAULT_STRING_CHARSET
    
protected  CharsetdbfCharset
    
final protected  URLdbfURL
    
protected  URInamespace
    
final protected  URLprjURL
    
protected  LockreadWriteLock
    
protected  FeatureTypeschema
    
final protected  URLshpURL
    
final protected  URLshxURL
    
protected  booleanuseMemoryMappedBuffer
    
final protected  URLxmlURL
    

Constructor Summary
public  ShapefileDataStore(URL url)
     Creates a new instance of ShapefileDataStore.
Parameters:
  url - The URL of the shp file to use for this DataSource.
throws:
  NullPointerException - DOCUMENT ME! .
public  ShapefileDataStore(URL url, boolean useMemoryMappedBuffer)
    
public  ShapefileDataStore(URL url, boolean useMemoryMappedBuffer, Charset dbfCharset)
    
public  ShapefileDataStore(URL url, URI namespace)
     this sets the datastore's namespace during construction (so the schema - FeatureType - will have the correct value) You can call this with namespace = null, but I suggest you give it an actual namespace.
public  ShapefileDataStore(URL url, URI namespace, boolean useMemoryMapped, Charset dbfCharset)
     this sets the datastore's namespace during construction (so the schema - FeatureType - will have the correct value) You can call this with namespace = null, but I suggest you give it an actual namespace.
public  ShapefileDataStore(URL url, URI namespace, boolean useMemoryMapped)
     this sets the datastore's namespace during construction (so the schema - FeatureType - will have the correct value) You can call this with namespace = null, but I suggest you give it an actual namespace.

Method Summary
protected  voidcopyAndDelete(URL src, long temp)
    
protected static  DbaseFileHeadercreateDbaseHeader(FeatureType featureType)
     Attempt to create a DbaseFileHeader for the FeatureType.
protected  FeatureReadercreateFeatureReader(String typeName, Reader r, FeatureType readerSchema)
    
protected  StringcreateFeatureTypeName()
     Create the type name of the single FeatureType this DataStore represents.
For example, if the urls path is file:///home/billy/mytheme.shp, the type name will be mytheme.
protected  FeatureWritercreateFeatureWriter(String typeName, Transaction transaction)
     Create a FeatureWriter for the given type name.
protected  MapcreateMetadata(String typeName)
     Latch onto xmlURL if it is there, we may be able to get out of calculating the bounding box!

This method is called by the createTypeEntry anonymous inner class DefaultTypeEntry.

public  voidcreateSchema(FeatureType featureType)
     Set the FeatureType of this DataStore.
public  voidforceSchemaCRS(CoordinateReferenceSystem crs)
     This method is used to force the creation of a .prj file.

The internally cached FeatureType will be removed, so the next call to getSchema() will read in the created file.

protected  ReadergetAttributesReader(boolean readDbf)
     Returns the attribute reader, allowing for a pure shapefile reader, or a combined dbf/shp reader.
protected  EnvelopegetBounds()
    
protected  EnvelopegetBounds(Query query)
    
public  intgetCount(Query query)
    
protected  StringgetCurrentTypeName()
    
protected  FeatureReadergetFeatureReader(String typeName)
     Create a FeatureReader for the provided type name.
Parameters:
  typeName - The name of the FeatureType to create a reader for.
protected  FeatureReadergetFeatureReader()
    
protected  FeatureReadergetFeatureReader(String typeName, Query query)
     Just like the basic version, but adds a small optimization: if no attributes are going to be read, don't uselessly open and read the dbf file.
public  FeatureSourcegetFeatureSource(String typeName)
    
protected  ReadableByteChannelgetReadChannel(URL url)
     Obtain a ReadableByteChannel from the given URL.
public  FeatureTypegetSchema(String typeName)
     Obtain the FeatureType of the given name.
public  FeatureTypegetSchema()
    
protected  FilegetStorageFile(URL url, long temp)
    
protected  URLgetStorageURL(URL url, long temp)
    
public  CharsetgetStringCharset()
    
public  String[]getTypeNames()
     Get an array of type names this DataStore holds.
ShapefileDataStore will always return a single name.
protected  WritableByteChannelgetWriteChannel(URL url)
     Obtain a WritableByteChannel from the given URL.
public  booleanisLocal()
     Determine if the location of this shapefile is local or remote.
protected  DbaseFileReaderopenDbfReader()
     Convenience method for opening a DbaseFileReader.
protected  IndexFileopenIndexFile(URL shxURL)
     Convenience method for opening an index file.
protected  PrjFileReaderopenPrjReader()
     Convenience method for opening a DbaseFileReader.
protected  ShapefileReaderopenShapeReader()
     Convenience method for opening a ShapefileReader.
protected  AttributeType[]readAttributes()
     Create the AttributeTypes contained within this DataStore.
public  voidsetStringCharset(Charset stringCharset)
    
protected  voidtypeCheck(String requested)
     A convenience method to check if a type name is correct.

Field Detail
DEFAULT_STRING_CHARSET
final public static Charset DEFAULT_STRING_CHARSET(Code)



dbfCharset
protected Charset dbfCharset(Code)



dbfURL
final protected URL dbfURL(Code)



namespace
protected URI namespace(Code)



prjURL
final protected URL prjURL(Code)



readWriteLock
protected Lock readWriteLock(Code)



schema
protected FeatureType schema(Code)



shpURL
final protected URL shpURL(Code)



shxURL
final protected URL shxURL(Code)



useMemoryMappedBuffer
protected boolean useMemoryMappedBuffer(Code)



xmlURL
final protected URL xmlURL(Code)




Constructor Detail
ShapefileDataStore
public ShapefileDataStore(URL url) throws java.net.MalformedURLException(Code)
Creates a new instance of ShapefileDataStore.
Parameters:
  url - The URL of the shp file to use for this DataSource.
throws:
  NullPointerException - DOCUMENT ME! . If computation of related URLs (dbf,shx) fails.



ShapefileDataStore
public ShapefileDataStore(URL url, boolean useMemoryMappedBuffer) throws java.net.MalformedURLException(Code)



ShapefileDataStore
public ShapefileDataStore(URL url, boolean useMemoryMappedBuffer, Charset dbfCharset) throws java.net.MalformedURLException(Code)



ShapefileDataStore
public ShapefileDataStore(URL url, URI namespace) throws java.net.MalformedURLException(Code)
this sets the datastore's namespace during construction (so the schema - FeatureType - will have the correct value) You can call this with namespace = null, but I suggest you give it an actual namespace.
Parameters:
  url -
Parameters:
  namespace -



ShapefileDataStore
public ShapefileDataStore(URL url, URI namespace, boolean useMemoryMapped, Charset dbfCharset) throws java.net.MalformedURLException(Code)
this sets the datastore's namespace during construction (so the schema - FeatureType - will have the correct value) You can call this with namespace = null, but I suggest you give it an actual namespace.
Parameters:
  url -
Parameters:
  namespace -
Parameters:
  useMemoryMapped -
Parameters:
  dbfCharset -



ShapefileDataStore
public ShapefileDataStore(URL url, URI namespace, boolean useMemoryMapped) throws java.net.MalformedURLException(Code)
this sets the datastore's namespace during construction (so the schema - FeatureType - will have the correct value) You can call this with namespace = null, but I suggest you give it an actual namespace.
Parameters:
  url -
Parameters:
  namespace -
Parameters:
  useMemoryMapped -




Method Detail
copyAndDelete
protected void copyAndDelete(URL src, long temp) throws IOException(Code)
Copy the file at the given URL to the original
Parameters:
  src - DOCUMENT ME!
Parameters:
  temp - DOCUMENT ME!
throws:
  IOException - DOCUMENT ME!



createDbaseHeader
protected static DbaseFileHeader createDbaseHeader(FeatureType featureType) throws IOException, DbaseFileException(Code)
Attempt to create a DbaseFileHeader for the FeatureType. Note, we cannot set the number of records until the write has completed.
Parameters:
  featureType - DOCUMENT ME! DOCUMENT ME!
throws:
  IOException - DOCUMENT ME!
throws:
  DbaseFileException - DOCUMENT ME!



createFeatureReader
protected FeatureReader createFeatureReader(String typeName, Reader r, FeatureType readerSchema) throws SchemaException(Code)



createFeatureTypeName
protected String createFeatureTypeName()(Code)
Create the type name of the single FeatureType this DataStore represents.
For example, if the urls path is file:///home/billy/mytheme.shp, the type name will be mytheme. A name based upon the last path component of the url minus theextension.



createFeatureWriter
protected FeatureWriter createFeatureWriter(String typeName, Transaction transaction) throws IOException(Code)
Create a FeatureWriter for the given type name.
Parameters:
  typeName - The typeName of the FeatureType to write
Parameters:
  transaction - DOCUMENT ME! A new FeatureWriter.
throws:
  IOException - If the typeName is not available or some other erroroccurs.



createMetadata
protected Map createMetadata(String typeName)(Code)
Latch onto xmlURL if it is there, we may be able to get out of calculating the bounding box!

This method is called by the createTypeEntry anonymous inner class DefaultTypeEntry.


Parameters:
  typeName - DOCUMENT ME! Map with xmlURL parsed, or an EMPTY_MAP.



createSchema
public void createSchema(FeatureType featureType) throws IOException(Code)
Set the FeatureType of this DataStore. This method will delete any existing local resources or throw an IOException if the DataStore is remote.
Parameters:
  featureType - The desired FeatureType.
throws:
  IOException - If the DataStore is remote.



forceSchemaCRS
public void forceSchemaCRS(CoordinateReferenceSystem crs) throws IOException(Code)
This method is used to force the creation of a .prj file.

The internally cached FeatureType will be removed, so the next call to getSchema() will read in the created file. This method is not thread safe and will have dire consequences for any other thread making use of the shapefile.


Parameters:
  crs -




getAttributesReader
protected Reader getAttributesReader(boolean readDbf) throws IOException(Code)
Returns the attribute reader, allowing for a pure shapefile reader, or a combined dbf/shp reader.
Parameters:
  readDbf - - if true, the dbf fill will be opened and read
throws:
  IOException -



getBounds
protected Envelope getBounds() throws DataSourceException(Code)
Gets the bounding box of the file represented by this data store as a whole (that is, off all of the features in the shapefile) The bounding box of the datasource or null if unknown and tooexpensive for the method to calculate.
throws:
  DataSourceException - DOCUMENT ME!



getBounds
protected Envelope getBounds(Query query) throws IOException(Code)



getCount
public int getCount(Query query) throws IOException(Code)

See Also:   org.geotools.data.AbstractDataStore.getCount(org.geotools.data.Query)



getCurrentTypeName
protected String getCurrentTypeName()(Code)



getFeatureReader
protected FeatureReader getFeatureReader(String typeName) throws IOException(Code)
Create a FeatureReader for the provided type name.
Parameters:
  typeName - The name of the FeatureType to create a reader for. A new FeatureReader.
throws:
  IOException - If an error occurs during creation



getFeatureReader
protected FeatureReader getFeatureReader() throws IOException(Code)



getFeatureReader
protected FeatureReader getFeatureReader(String typeName, Query query) throws IOException(Code)
Just like the basic version, but adds a small optimization: if no attributes are going to be read, don't uselessly open and read the dbf file. Makes sure to consider also attributes in the query.
See Also:   org.geotools.data.AbstractDataStore.getFeatureReader(java.lang.Stringorg.geotools.data.Query)



getFeatureSource
public FeatureSource getFeatureSource(String typeName) throws IOException(Code)

See Also:   org.geotools.data.DataStore.getFeatureSource(java.lang.String)



getReadChannel
protected ReadableByteChannel getReadChannel(URL url) throws IOException(Code)
Obtain a ReadableByteChannel from the given URL. If the url protocol is file, a FileChannel will be returned. Otherwise a generic channel will be obtained from the urls input stream.
Parameters:
  url - DOCUMENT ME! DOCUMENT ME!
throws:
  IOException - DOCUMENT ME!



getSchema
public FeatureType getSchema(String typeName) throws IOException(Code)
Obtain the FeatureType of the given name. ShapefileDataStore contains only one FeatureType.
Parameters:
  typeName - The name of the FeatureType. The FeatureType that this DataStore contains.
throws:
  IOException - If a type by the requested name is not present.



getSchema
public FeatureType getSchema() throws IOException(Code)



getStorageFile
protected File getStorageFile(URL url, long temp)(Code)
Get a temproray File based on the URL passed in
Parameters:
  url - DOCUMENT ME!
Parameters:
  temp - DOCUMENT ME! DOCUMENT ME!



getStorageURL
protected URL getStorageURL(URL url, long temp) throws java.net.MalformedURLException(Code)
Get a temporary URL for storage based on the one passed in
Parameters:
  url - DOCUMENT ME!
Parameters:
  temp - DOCUMENT ME! DOCUMENT ME!



getStringCharset
public Charset getStringCharset()(Code)
Returns the Charset used to decode strings in the DBF file



getTypeNames
public String[] getTypeNames()(Code)
Get an array of type names this DataStore holds.
ShapefileDataStore will always return a single name. An array of length one containing the single type held.



getWriteChannel
protected WritableByteChannel getWriteChannel(URL url) throws IOException(Code)
Obtain a WritableByteChannel from the given URL. If the url protocol is file, a FileChannel will be returned. Currently, this method will return a generic channel for remote urls, however both shape and dbf writing can only occur with a local FileChannel channel.
Parameters:
  url - DOCUMENT ME! DOCUMENT ME!
throws:
  IOException - DOCUMENT ME!



isLocal
public boolean isLocal()(Code)
Determine if the location of this shapefile is local or remote. true if local, false if remote



openDbfReader
protected DbaseFileReader openDbfReader() throws IOException(Code)
Convenience method for opening a DbaseFileReader. A new DbaseFileReader
throws:
  IOException - If an error occurs during creation.



openIndexFile
protected IndexFile openIndexFile(URL shxURL) throws IOException(Code)
Convenience method for opening an index file.
Parameters:
  shxURL - TODO An IndexFile
throws:
  IOException -



openPrjReader
protected PrjFileReader openPrjReader() throws IOException, FactoryException(Code)
Convenience method for opening a DbaseFileReader. A new DbaseFileReader
throws:
  IOException - If an error occurs during creation.
throws:
  FactoryException - DOCUMENT ME!



openShapeReader
protected ShapefileReader openShapeReader() throws IOException(Code)
Convenience method for opening a ShapefileReader. A new ShapefileReader.
throws:
  IOException - If an error occurs during creation.
throws:
  DataSourceException - DOCUMENT ME!



readAttributes
protected AttributeType[] readAttributes() throws IOException(Code)
Create the AttributeTypes contained within this DataStore. An array of new AttributeTypes
throws:
  IOException - If AttributeType reading fails



setStringCharset
public void setStringCharset(Charset stringCharset)(Code)
Set this if you need BDF strings to be decoded in a Charset other than ISO-8859-1
Parameters:
  stringCharset -
since:
   2.3.3



typeCheck
protected void typeCheck(String requested) throws IOException(Code)
A convenience method to check if a type name is correct.
Parameters:
  requested - The type name requested.
throws:
  IOException - If the type name is not available



Methods inherited from org.geotools.data.AbstractFileDataStore
abstract protected FeatureReader getFeatureReader() throws IOException(Code)(Java Doc)
public FeatureSource getFeatureSource() throws IOException(Code)(Java Doc)
public FeatureWriter getFeatureWriter(Filter filter, Transaction transaction) throws IOException(Code)(Java Doc)
public FeatureWriter getFeatureWriter(Transaction transaction) throws IOException(Code)(Java Doc)
public FeatureWriter getFeatureWriterAppend(Transaction transaction) throws IOException(Code)(Java Doc)
abstract public FeatureType getSchema() throws IOException(Code)(Java Doc)
public void updateSchema(FeatureType featureType) throws IOException(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.