### Question:
CsvFile implements CsvSourceParser, CsvSource { private void parseHeader() throws IOException { if (!propertiesParsed) { throw new IllegalStateException("Properties need to be parsed before header."); } stream.seek(propertiesByteSize); String line; long posInStream = stream.getStreamPosition(); while ((line = stream.readLine()) != null) { if (line.startsWith("#")) { propertiesByteSize += (stream.getStreamPosition() - posInStream); posInStream = stream.getStreamPosition(); continue; } headerByteSize += (stream.getStreamPosition() - posInStream); final String separator = properties.get("separator") != null ? properties.get("separator") : Constants.DEFAULT_SEPARATOR; createFeatureType(line.split(separator)); break; } } private  CsvFile(String csv); private  CsvFile(File csv, CoordinateReferenceSystem crs); static CsvSourceParser createCsvSourceParser(String csv); @Override void parseRecords(int offset, int numRecords); @Override CsvSource parseMetadata(); @Override void close(); @Override int getRecordCount(); @Override SimpleFeature[] getSimpleFeatures(); @Override SimpleFeatureType getFeatureType(); @Override Map<String, String> getProperties(); static final String DEFAULT_HEADER_NAME; }### Answer:
@Test public void testParseHeader() throws Exception { final String simpleFormatExample = getClass().getResource("reader/simple_format_example.txt").getFile(); final CsvSourceParser parser = CsvFile.createCsvSourceParser(simpleFormatExample); parser.parseMetadata(); final CsvSource csvSource = parser.parseMetadata(); final FeatureType featureType = csvSource.getFeatureType(); assertNotNull(featureType); final PropertyDescriptor[] propertyDescriptors = toPropertyDescriptorArray(featureType.getDescriptors()); assertEquals(7, propertyDescriptors.length); assertEquals("station", propertyDescriptors[0].getName().toString()); assertEquals("lat", propertyDescriptors[1].getName().toString()); assertEquals("lon", propertyDescriptors[2].getName().toString()); assertEquals("date_time", propertyDescriptors[3].getName().toString()); assertEquals("radiance_1", propertyDescriptors[4].getName().toString()); assertEquals("radiance_2", propertyDescriptors[5].getName().toString()); assertEquals("testTime", propertyDescriptors[6].getName().toString()); assertEquals(7, propertyDescriptors.length); assertTrue(propertyDescriptors[0].getType().getBinding().getSimpleName().matches(".*String")); assertTrue(propertyDescriptors[1].getType().getBinding().getSimpleName().matches(".*Float")); assertTrue(propertyDescriptors[2].getType().getBinding().getSimpleName().matches(".*Float")); assertTrue(propertyDescriptors[3].getType().getBinding().getSimpleName().matches(".*UTC")); assertTrue(propertyDescriptors[4].getType().getBinding().getSimpleName().matches(".*Float")); assertTrue(propertyDescriptors[5].getType().getBinding().getSimpleName().matches(".*Float")); assertTrue(propertyDescriptors[6].getType().getBinding().getSimpleName().matches(".*UTC")); }