public class ShapefileDataStore extends ContentDataStore implements FileDataStore
| Modifier and Type | Field and Description |
|---|---|
static Charset |
DEFAULT_STRING_CHARSET |
static TimeZone |
DEFAULT_TIMEZONE |
static String |
ORIGINAL_FIELD_DUPLICITY_COUNT |
static String |
ORIGINAL_FIELD_NAME |
protected static Boolean |
TRACE_ENABLED
When true, the stack trace that got a lock that wasn't released is recorded and then printed
out when warning the user about this.
|
dataStoreFactory, entries, featureFactory, filterFactory, geometryFactory, JOINED_FEATURE_TYPE, lockingManager, LOGGER, namespaceURI, typeFactory, WRITER_ADD, WRITER_COMMIT, WRITER_UPDATE| Constructor and Description |
|---|
ShapefileDataStore(URL url) |
| Modifier and Type | Method and Description |
|---|---|
protected static DbaseFileHeader |
createDbaseHeader(SimpleFeatureType featureType)
Attempt to create a DbaseFileHeader for the FeatureType.
|
protected ContentFeatureSource |
createFeatureSource(ContentEntry entry)
Instantiates new feature source for the entry.
|
void |
createSchema(SimpleFeatureType featureType)
Set the FeatureType of this DataStore.
|
protected List<Name> |
createTypeNames()
Creates a set of qualified names corresponding to the types that the datastore provides.
|
void |
dispose()
Disposes of this data store and releases any resource that it is using.
|
protected void |
finalize() |
void |
forceSchemaCRS(CoordinateReferenceSystem crs)
This method is used to force the creation of a .prj file.
|
Charset |
getCharset() |
long |
getCount(Query query) |
FeatureReader<SimpleFeatureType,SimpleFeature> |
getFeatureReader() |
ContentFeatureSource |
getFeatureSource() |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getFeatureWriter(Filter filter,
Transaction transaction) |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getFeatureWriter(Transaction transaction) |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getFeatureWriterAppend(Transaction transaction) |
SimpleFeatureType |
getSchema()
FeatureType for the file being read.
|
TimeZone |
getTimeZone() |
boolean |
isBufferCachingEnabled() |
boolean |
isFidIndexed()
Returns true if the store uses the .fix index file for feature ids.
|
boolean |
isIndexCreationEnabled() |
boolean |
isIndexed() |
boolean |
isMemoryMapped() |
void |
removeSchema(Name typeName)
Used to permanently remove a schema from the underlying storage
This functionality is similar to an "drop table" statement in SQL.
|
void |
removeSchema(String typeName)
Used to permanently remove a schema from the underlying storage
This functionality is similar to an "drop table" statement in SQL.
|
void |
setBufferCachingEnabled(boolean bufferCachingEnabled) |
void |
setCharset(Charset charset) |
void |
setFidIndexed(boolean fidIndexed)
Enables/disables the feature id index.
|
void |
setIndexCreationEnabled(boolean indexCreationEnabled)
If true (default) the index file will be created on demand if missing
|
void |
setIndexed(boolean indexed)
When set to true, will use the spatial index if available (but will not create it if missing,
unless also indexCreationEnabled is true)
|
void |
setMemoryMapped(boolean memoryMapped) |
void |
setTimeZone(TimeZone timeZone) |
String |
toString() |
void |
updateSchema(SimpleFeatureType featureType) |
createContentState, ensureEntry, ensureFeatureStore, entry, getDataStoreFactory, getEntry, getFeatureFactory, getFeatureReader, getFeatureSource, getFeatureSource, getFeatureSource, getFeatureSource, getFeatureTypeFactory, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getFilterFactory, getGeometryFactory, getInfo, getLockingManager, getLogger, getNames, getNamespaceURI, getSchema, getSchema, getTypeNames, name, removeEntry, setDataStoreFactory, setFeatureFactory, setFeatureTypeFactory, setFilterFactory, setGeometryFactory, setNamespaceURI, updateSchema, updateSchemaclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitgetFeatureReader, getFeatureSource, getFeatureSource, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getLockingManager, getSchema, getTypeNames, updateSchemagetInfo, getNames, getSchema, updateSchemapublic static final String ORIGINAL_FIELD_NAME
public static final String ORIGINAL_FIELD_DUPLICITY_COUNT
public static final Charset DEFAULT_STRING_CHARSET
public static final TimeZone DEFAULT_TIMEZONE
protected static final Boolean TRACE_ENABLED
public ShapefileDataStore(URL url)
protected List<Name> createTypeNames() throws IOException
ContentDataStoreNamespaces may be left null for data stores which do not support namespace
qualified type names.
createTypeNames in class ContentDataStoreName.IOException - Any errors occuring connecting to data.protected ContentFeatureSource createFeatureSource(ContentEntry entry) throws IOException
ContentDataStoreSubclasses should override this method to return a specific subclass of ContentFeatureSource.
createFeatureSource in class ContentDataStoreentry - The entry.ContentFeatureSource for the entry.IOExceptionpublic ContentFeatureSource getFeatureSource() throws IOException
getFeatureSource in interface FileDataStoreIOExceptionDataStore.getFeatureSource(java.lang.String)public Charset getCharset()
public void setCharset(Charset charset)
public TimeZone getTimeZone()
public void setTimeZone(TimeZone timeZone)
public boolean isMemoryMapped()
public void setMemoryMapped(boolean memoryMapped)
public boolean isBufferCachingEnabled()
public void setBufferCachingEnabled(boolean bufferCachingEnabled)
public boolean isIndexed()
public void setIndexed(boolean indexed)
indexed - public SimpleFeatureType getSchema() throws IOException
FileDataStoreThis is the same as getSchema( getTypeName[0] )
getSchema in interface FileDataStoreIOExceptionDataStore.getSchema(java.lang.String)public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader() throws IOException
getFeatureReader in interface FileDataStoreIOExceptionorg.geotools.data.DataStore#getFeatureReader(java.lang.String)public long getCount(Query query) throws IOException
IOExceptionpublic void createSchema(SimpleFeatureType featureType) throws IOException
createSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>createSchema in class ContentDataStorefeatureType - The desired FeatureType.IOException - If the DataStore is remote.DataAccess.createSchema(FeatureType)protected static DbaseFileHeader createDbaseHeader(SimpleFeatureType featureType) throws IOException, DbaseFileException
featureType - DOCUMENT ME!IOException - DOCUMENT ME!DbaseFileException - DOCUMENT ME!public void forceSchemaCRS(CoordinateReferenceSystem crs) throws IOException
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.
crs - IOExceptionpublic void dispose()
DataAccessA DataStore cannot be used after dispose has been called,
neither can any data access object it helped create, such as FeatureReader, FeatureSource or FeatureCollection.
This operation can be called more than once without side effects.
There is no thread safety assurance associated with this method. For example, client code will have to make sure this method is not called while retrieving/saving data from/to the storage, or be prepared for the consequences.
dispose in interface DataAccess<SimpleFeatureType,SimpleFeature>dispose in class ContentDataStoreprotected void finalize()
throws Throwable
public boolean isFidIndexed()
public void setFidIndexed(boolean fidIndexed)
fidIndexed - public void updateSchema(SimpleFeatureType featureType) throws IOException
updateSchema in interface FileDataStoreIOExceptionDataStore.updateSchema(java.lang.String,SimpleFeatureType)public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(Filter filter, Transaction transaction) throws IOException
getFeatureWriter in interface FileDataStoreIOExceptionorg.geotools.data.DataStore#getFeatureWriter(Filter,Transaction)public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(Transaction transaction) throws IOException
getFeatureWriter in interface FileDataStoreIOExceptionDataStore.getFeatureWriter(java.lang.String,
org.geotools.data.Transaction)public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(Transaction transaction) throws IOException
getFeatureWriterAppend in interface FileDataStoreIOExceptionDataStore.getFeatureWriterAppend(java.lang.String,
org.geotools.data.Transaction)public boolean isIndexCreationEnabled()
public void setIndexCreationEnabled(boolean indexCreationEnabled)
indexCreationEnabled - public void removeSchema(String typeName) throws IOException
DataStoreThis functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
removeSchema in interface DataStoreremoveSchema in class ContentDataStoreIOException - if the operation failedDataStore.removeSchema(String)public void removeSchema(Name typeName) throws IOException
DataAccessThis functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
removeSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>removeSchema in class ContentDataStoreIOException - if the operation failedDataAccess.removeSchema(Name)Copyright © 1996–2019 Geotools. All rights reserved.