private SimpleFeatureType readFeatureType() throws IOException { String[] tokens = reader.readRecord(); if (tokens == null || tokens.length <= 1) { throw new IOException("Missing feature type definition in first line."); } reader.mark(1024 * 1024 * 10); return createFeatureType(tokens); }
/** * Collects comment lines of the form "# <name> = <value>" until the first non-empty and non-comment line is found. * * @throws java.io.IOException */ private void readProperties() throws IOException { properties = new OrderRetainingMap(); String line; while ((line = reader.readLine()) != null) { line = line.trim(); if (line.startsWith("#")) { line = line.substring(1); int index = line.indexOf('='); if (index != -1) { String name = line.substring(0, index).trim(); String value = line.substring(index + 1).trim(); if (StringUtils.isNotNullAndNotEmpty(name) && StringUtils.isNotNullAndNotEmpty(value)) { properties.put(name, value); } } reader.mark(1024 * 1024 * 10); } else if (line.isEmpty()) { reader.mark(1024 * 1024 * 10); } else { // First non-comment line reached, no more property assignments expected break; } } }
VectorDataNode read(CoordinateReferenceSystem modelCrs, ProgressMonitor pm) throws IOException { String nodeName = FileUtils.getFilenameWithoutExtension(sourceName); pm.beginTask("Reading vector data node '" + nodeName + "'", 100); reader.mark(1024 * 1024 * 10); readProperties(); pm.worked(5);