public IndexedShapefileFeatureWriter(String typeName, ShpFiles shpFiles, IndexedShapefileAttributeReader attsReader, FeatureReader<SimpleFeatureType, SimpleFeature> featureReader, IndexedShapefileDataStore datastore, Charset charset, TimeZone timeZone) throws IOException { super(typeName, shpFiles, attsReader, featureReader, charset, timeZone); this.indexedShapefileDataStore = datastore; if (!datastore.isLocal()) { this.fidWriter = IndexedFidWriter.EMPTY_WRITER; } else { StorageFile storageFile = shpFiles.getStorageFile(FIX); storageFiles.put(FIX, storageFile); this.fidWriter = new IndexedFidWriter(shpFiles, storageFile); } }
public IndexedShapefileFeatureWriter(String typeName, ShpFiles shpFiles, IndexedShapefileAttributeReader attsReader, FeatureReader<SimpleFeatureType, SimpleFeature> featureReader, IndexedShapefileDataStore datastore, Charset charset, TimeZone timeZone) throws IOException { super(typeName, shpFiles, attsReader, featureReader, charset, timeZone); this.indexedShapefileDataStore = datastore; if (!datastore.isLocal()) { this.fidWriter = IndexedFidWriter.EMPTY_WRITER; } else { StorageFile storageFile = shpFiles.getStorageFile(FIX); storageFiles.put(FIX, storageFile); this.fidWriter = new IndexedFidWriter(shpFiles, storageFile); } }
FileChannel writeChannel = getWriteChannel(fixURL); writer = new IndexedFidWriter(writeChannel, new IndexedFidReader(filename.substring(indexslash), writeChannel));
/** * Generates the FID index file for the shpFiles */ public static void generate(ShpFiles shpFiles) throws IOException { LOGGER.fine("Generating fids for " + shpFiles.get(SHP)); IndexFile indexFile = null; StorageFile file = shpFiles.getStorageFile(FIX); IndexedFidWriter writer = null; try { indexFile = new IndexFile(shpFiles, false); // writer closes channel for you. writer = new IndexedFidWriter(shpFiles, file); for (int i = 0, j = indexFile.getRecordCount(); i < j; i++) { writer.next(); } } finally { try { if (writer != null) { writer.close(); } file.replaceOriginal(); } finally { if (indexFile != null) { indexFile.close(); } } } }
/** * Generates the FID index file for the shpFiles */ public static void generate(ShpFiles shpFiles) throws IOException { LOGGER.fine("Generating fids for " + shpFiles.get(SHP)); IndexFile indexFile = null; StorageFile file = shpFiles.getStorageFile(FIX); IndexedFidWriter writer = null; try { indexFile = new IndexFile(shpFiles, false); // writer closes channel for you. writer = new IndexedFidWriter(shpFiles, file); for (int i = 0, j = indexFile.getRecordCount(); i < j; i++) { writer.next(); } } finally { try { if (writer != null) { writer.close(); } file.replaceOriginal(); } finally { if (indexFile != null) { indexFile.close(); } } } }
indexedFidWriter = new IndexedFidWriter(fidIndexChannel, new IndexedFidReader(getCurrentTypeName(), temp!=0?getReadChannel(fixURL):fidIndexChannel));