Class ShapefileDataStore

    • Field Detail

      • ORIGINAL_FIELD_DUPLICITY_COUNT

        public static final String ORIGINAL_FIELD_DUPLICITY_COUNT
        See Also:
        Constant Field Values
      • DEFAULT_STRING_CHARSET

        public static final Charset DEFAULT_STRING_CHARSET
      • DEFAULT_TIMEZONE

        public static final TimeZone DEFAULT_TIMEZONE
      • TRACE_ENABLED

        protected static final 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.
    • Constructor Detail

      • ShapefileDataStore

        public ShapefileDataStore​(URL url)
      • ShapefileDataStore

        public ShapefileDataStore​(URL url,
                                  boolean skipScan)
    • Method Detail

      • createTypeNames

        protected List<Name> createTypeNames()
                                      throws IOException
        Description copied from class: ContentDataStore
        Creates a set of qualified names corresponding to the types that the datastore provides.

        Namespaces may be left null for data stores which do not support namespace qualified type names.

        Specified by:
        createTypeNames in class ContentDataStore
        Returns:
        A list of Name.
        Throws:
        IOException - Any errors occuring connecting to data.
      • getCharset

        public Charset getCharset()
      • setCharset

        public void setCharset​(Charset charset)
      • getTimeZone

        public TimeZone getTimeZone()
      • setTimeZone

        public void setTimeZone​(TimeZone timeZone)
      • isMemoryMapped

        public boolean isMemoryMapped()
      • setMemoryMapped

        public void setMemoryMapped​(boolean memoryMapped)
      • isBufferCachingEnabled

        public boolean isBufferCachingEnabled()
      • setBufferCachingEnabled

        public void setBufferCachingEnabled​(boolean bufferCachingEnabled)
      • isIndexed

        public boolean isIndexed()
      • setIndexed

        public 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)
      • isTryCPGFile

        public boolean isTryCPGFile()
        Returns true, if the store tries to guess DBF file charset from CPG file
      • setTryCPGFile

        public void setTryCPGFile​(boolean tryCPGFile)
        Makes the store try to figure out DBF file charset from CPG file. If succeeds, the charset property will be rewritten by guessed value.
      • getCount

        public long getCount​(Query query)
                      throws IOException
        Throws:
        IOException
      • forceSchemaCRS

        public void forceSchemaCRS​(CoordinateReferenceSystem crs)
                            throws IOException
        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.

        Throws:
        IOException
      • dispose

        public void dispose()
        Description copied from interface: DataAccess
        Disposes of this data store and releases any resource that it is using.

        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.

        Specified by:
        dispose in interface DataAccess<SimpleFeatureType,​SimpleFeature>
        Overrides:
        dispose in class ContentDataStore
      • finalize

        protected void finalize()
                         throws Throwable
        Overrides:
        finalize in class Object
        Throws:
        Throwable
      • isFidIndexed

        public boolean isFidIndexed()
        Returns true if the store uses the .fix index file for feature ids. The .fix file speeds up filters by feature id and allows for stable ids in face of feature removals, without it the feature id is simply the position of the feature in the shapefile, something which changes when data is removed
      • setFidIndexed

        public void setFidIndexed​(boolean fidIndexed)
        Enables/disables the feature id index. The index is enabled by default
      • toString

        public String toString()
        Overrides:
        toString in class Object
      • isIndexCreationEnabled

        public boolean isIndexCreationEnabled()
      • setIndexCreationEnabled

        public void setIndexCreationEnabled​(boolean indexCreationEnabled)
        If true (default) the index file will be created on demand if missing
      • removeSchema

        public void removeSchema​(String typeName)
                          throws IOException
        Description copied from interface: DataStore
        Used to permanently remove a schema from the underlying storage

        This functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.

        Specified by:
        removeSchema in interface DataStore
        Overrides:
        removeSchema in class ContentDataStore
        Throws:
        IOException - if the operation failed
        See Also:
        DataStore.removeSchema(String)