Class FGBDriver
- java.lang.Object
-
- org.h2gis.functions.io.fgb.fileTable.FGBDriver
-
- All Implemented Interfaces:
org.h2gis.api.FileDriver
public class FGBDriver extends Object implements org.h2gis.api.FileDriver
FlatGeobuffer reader driver- Author:
- Erwan Bocher, Nicolas Fortin
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFGBDriver.FGBDriverCursor
-
Constructor Summary
Constructors Constructor Description FGBDriver()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcacheFeatureAddressFromIndex()Using the Spatial index it is possible to quickly cache the file address of all features.voidclose()intgetEstimatedRowSize(long rowId)longgetFeaturesOffset()org.h2.value.ValuegetField(long rowId, int columnId)intgetFieldCount()static org.h2.value.Value[]getFieldsFromFileLocation(FileChannel fileChannel, long featureAddress, long featuresOffset, org.wololo.flatgeobuf.HeaderMeta headerMeta, int geometryFieldIndex)intgetGeometryFieldIndex()org.wololo.flatgeobuf.HeaderMetagetHeader()longgetRowCount()voidinitDriverFromFile(File fgbFile)Init file header for DBF FilevoidinsertRow(Object[] values)booleanisCacheRowAddress()org.h2.index.CursorqueryIndex(org.locationtech.jts.geom.Envelope queryEnvelope)voidsetCacheRowAddress(boolean cacheRowAddress)
-
-
-
Method Detail
-
initDriverFromFile
public void initDriverFromFile(File fgbFile) throws IOException
Init file header for DBF File- Parameters:
fgbFile- DBF File path- Throws:
IOException
-
isCacheRowAddress
public boolean isCacheRowAddress()
-
setCacheRowAddress
public void setCacheRowAddress(boolean cacheRowAddress)
- Parameters:
cacheRowAddress- If true the feature file address will be cached in order to reduce random access time. If the file will be read sequentially only you can disable the cache in order to reduce the memory footprint
-
getHeader
public org.wololo.flatgeobuf.HeaderMeta getHeader()
-
getRowCount
public long getRowCount()
- Specified by:
getRowCountin interfaceorg.h2gis.api.FileDriver
-
getEstimatedRowSize
public int getEstimatedRowSize(long rowId)
- Specified by:
getEstimatedRowSizein interfaceorg.h2gis.api.FileDriver
-
getFieldCount
public int getFieldCount()
- Specified by:
getFieldCountin interfaceorg.h2gis.api.FileDriver
-
close
public void close() throws IOException- Specified by:
closein interfaceorg.h2gis.api.FileDriver- Throws:
IOException
-
queryIndex
public org.h2.index.Cursor queryIndex(org.locationtech.jts.geom.Envelope queryEnvelope) throws IOException- Throws:
IOException
-
cacheFeatureAddressFromIndex
public void cacheFeatureAddressFromIndex() throws IOExceptionUsing the Spatial index it is possible to quickly cache the file address of all features. Using this function before doing a random access should reduce the access time.- Throws:
IOException
-
getFieldsFromFileLocation
public static org.h2.value.Value[] getFieldsFromFileLocation(FileChannel fileChannel, long featureAddress, long featuresOffset, org.wololo.flatgeobuf.HeaderMeta headerMeta, int geometryFieldIndex) throws IOException
- Parameters:
featureAddress- Feature address in the file relative to the first feature- Returns:
- Throws:
IOException
-
getField
public org.h2.value.Value getField(long rowId, int columnId) throws IOException- Specified by:
getFieldin interfaceorg.h2gis.api.FileDriver- Throws:
IOException
-
getFeaturesOffset
public long getFeaturesOffset()
-
insertRow
public void insertRow(Object[] values) throws IOException
- Specified by:
insertRowin interfaceorg.h2gis.api.FileDriver- Throws:
IOException
-
getGeometryFieldIndex
public int getGeometryFieldIndex()
- Returns:
- Field index of the geometry when using the method getField
-
-