| 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 |
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 void | copyAndDelete(URL src, long temp) | protected static DbaseFileHeader | createDbaseHeader(FeatureType featureType) Attempt to create a DbaseFileHeader for the FeatureType. | protected FeatureReader | createFeatureReader(String typeName, Reader r, FeatureType readerSchema) | protected String | createFeatureTypeName() 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 FeatureWriter | createFeatureWriter(String typeName, Transaction transaction) Create a FeatureWriter for the given type name. | protected Map | createMetadata(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 void | createSchema(FeatureType featureType) Set the FeatureType of this DataStore. | public void | forceSchemaCRS(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 Reader | getAttributesReader(boolean readDbf) Returns the attribute reader, allowing for a pure shapefile reader, or a
combined dbf/shp reader. | protected Envelope | getBounds() | protected Envelope | getBounds(Query query) | public int | getCount(Query query) | protected String | getCurrentTypeName() | protected FeatureReader | getFeatureReader(String typeName) Create a FeatureReader for the provided type name.
Parameters: typeName - The name of the FeatureType to create a reader for. | protected FeatureReader | getFeatureReader() | protected FeatureReader | getFeatureReader(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 FeatureSource | getFeatureSource(String typeName) | protected ReadableByteChannel | getReadChannel(URL url) Obtain a ReadableByteChannel from the given URL. | public FeatureType | getSchema(String typeName) Obtain the FeatureType of the given name. | public FeatureType | getSchema() | protected File | getStorageFile(URL url, long temp) | protected URL | getStorageURL(URL url, long temp) | public Charset | getStringCharset() | public String[] | getTypeNames() Get an array of type names this DataStore holds. ShapefileDataStore
will always return a single name. | protected WritableByteChannel | getWriteChannel(URL url) Obtain a WritableByteChannel from the given URL. | public boolean | isLocal() Determine if the location of this shapefile is local or remote. | protected DbaseFileReader | openDbfReader() Convenience method for opening a DbaseFileReader. | protected IndexFile | openIndexFile(URL shxURL) Convenience method for opening an index file. | protected PrjFileReader | openPrjReader() Convenience method for opening a DbaseFileReader. | protected ShapefileReader | openShapeReader() Convenience method for opening a ShapefileReader. | protected AttributeType[] | readAttributes() Create the AttributeTypes contained within this DataStore. | public void | setStringCharset(Charset stringCharset) | protected void | typeCheck(String requested) A convenience method to check if a type name is correct. |
DEFAULT_STRING_CHARSET | final public static Charset DEFAULT_STRING_CHARSET(Code) | | |
useMemoryMappedBuffer | protected boolean useMemoryMappedBuffer(Code) | | |
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, 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 - |
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! |
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! |
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 |
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. |
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 |
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! |
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 |
|
|