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, updateSchema
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFeatureReader, getFeatureSource, getFeatureSource, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getLockingManager, getSchema, getTypeNames, updateSchema
getInfo, getNames, getSchema, updateSchema
public 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
ContentDataStore
Namespaces may be left null
for data stores which do not support namespace
qualified type names.
createTypeNames
in class ContentDataStore
Name
.IOException
- Any errors occuring connecting to data.protected ContentFeatureSource createFeatureSource(ContentEntry entry) throws IOException
ContentDataStore
Subclasses should override this method to return a specific subclass of ContentFeatureSource
.
createFeatureSource
in class ContentDataStore
entry
- The entry.ContentFeatureSource
for the entry.IOException
public ContentFeatureSource getFeatureSource() throws IOException
getFeatureSource
in interface FileDataStore
IOException
DataStore.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
FileDataStore
This is the same as getSchema( getTypeName[0] )
getSchema
in interface FileDataStore
IOException
DataStore.getSchema(java.lang.String)
public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader() throws IOException
getFeatureReader
in interface FileDataStore
IOException
org.geotools.data.DataStore#getFeatureReader(java.lang.String)
public long getCount(Query query) throws IOException
IOException
public void createSchema(SimpleFeatureType featureType) throws IOException
createSchema
in interface DataAccess<SimpleFeatureType,SimpleFeature>
createSchema
in class ContentDataStore
featureType
- 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
- IOException
public void dispose()
DataAccess
A 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 ContentDataStore
protected void finalize() throws Throwable
public boolean isFidIndexed()
public void setFidIndexed(boolean fidIndexed)
fidIndexed
- public void updateSchema(SimpleFeatureType featureType) throws IOException
updateSchema
in interface FileDataStore
IOException
DataStore.updateSchema(java.lang.String,SimpleFeatureType)
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(Filter filter, Transaction transaction) throws IOException
getFeatureWriter
in interface FileDataStore
IOException
org.geotools.data.DataStore#getFeatureWriter(Filter,Transaction)
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(Transaction transaction) throws IOException
getFeatureWriter
in interface FileDataStore
IOException
DataStore.getFeatureWriter(java.lang.String,
org.geotools.data.Transaction)
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(Transaction transaction) throws IOException
getFeatureWriterAppend
in interface FileDataStore
IOException
DataStore.getFeatureWriterAppend(java.lang.String,
org.geotools.data.Transaction)
public boolean isIndexCreationEnabled()
public void setIndexCreationEnabled(boolean indexCreationEnabled)
indexCreationEnabled
- public void removeSchema(String typeName) throws IOException
DataStore
This 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 DataStore
removeSchema
in class ContentDataStore
IOException
- if the operation failedDataStore.removeSchema(String)
public void removeSchema(Name typeName) throws IOException
DataAccess
This 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 ContentDataStore
IOException
- if the operation failedDataAccess.removeSchema(Name)
Copyright © 1996–2019 Geotools. All rights reserved.