Package org.geotools.data.csv.parse
Class CSVStrategy
- Object
-
- CSVStrategy
-
- Direct Known Subclasses:
CSVAttributesOnlyStrategy
,CSVLatLonStrategy
,CSVSpecifiedWKTStrategy
public abstract class CSVStrategy extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected CSVFileState
csvFileState
protected SimpleFeatureType
featureType
-
Constructor Summary
Constructors Constructor Description CSVStrategy(CSVFileState csvFileState)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract SimpleFeatureType
buildFeatureType()
static SimpleFeatureTypeBuilder
createBuilder(CSVFileState csvFileState)
Originally in a strategy support class - giving a chance to override them to improve efficiency and utilise the different strategiesstatic SimpleFeatureTypeBuilder
createBuilder(CSVFileState csvFileState, String[] headers, Map<String,Class<?>> typesFromData)
abstract void
createSchema(SimpleFeatureType featureType)
abstract SimpleFeature
decode(String recordId, String[] csvRecord)
abstract String[]
encode(SimpleFeature feature)
protected static Map<String,Class<?>>
findMostSpecificTypesFromData(CSVReader csvReader, String[] headers)
Performs a full file scan attempting to guess the type of each column Specific strategy implementations will expand this functionality by overriding the buildFeatureType() method.char
getEscapechar()
SimpleFeatureType
getFeatureType()
String
getLineSeparator()
char
getQuotechar()
char
getSeparator()
boolean
isQuoteAllFields()
boolean
isWritePrj()
CSVIterator
iterator()
void
setEscapechar(char escapechar)
void
setLineSeparator(String lineSeparator)
void
setQuoteAllFields(boolean quoteAllFields)
void
setQuotechar(char quotechar)
void
setSeparator(char separator)
void
setWritePrj(boolean booleanValue)
-
-
-
Field Detail
-
csvFileState
protected final CSVFileState csvFileState
-
featureType
protected volatile SimpleFeatureType featureType
-
-
Constructor Detail
-
CSVStrategy
public CSVStrategy(CSVFileState csvFileState)
-
-
Method Detail
-
iterator
public CSVIterator iterator() throws IOException
- Throws:
IOException
-
buildFeatureType
protected abstract SimpleFeatureType buildFeatureType()
-
createSchema
public abstract void createSchema(SimpleFeatureType featureType) throws IOException
- Throws:
IOException
-
decode
public abstract SimpleFeature decode(String recordId, String[] csvRecord)
-
encode
public abstract String[] encode(SimpleFeature feature)
-
getFeatureType
public SimpleFeatureType getFeatureType()
-
createBuilder
public static SimpleFeatureTypeBuilder createBuilder(CSVFileState csvFileState)
Originally in a strategy support class - giving a chance to override them to improve efficiency and utilise the different strategies
-
createBuilder
public static SimpleFeatureTypeBuilder createBuilder(CSVFileState csvFileState, String[] headers, Map<String,Class<?>> typesFromData)
-
findMostSpecificTypesFromData
protected static Map<String,Class<?>> findMostSpecificTypesFromData(CSVReader csvReader, String[] headers) throws IOException
Performs a full file scan attempting to guess the type of each column Specific strategy implementations will expand this functionality by overriding the buildFeatureType() method.- Throws:
IOException
-
getSeparator
public char getSeparator()
- Returns:
- the separator
-
setSeparator
public void setSeparator(char separator)
- Parameters:
separator
- the separator to set
-
getQuotechar
public char getQuotechar()
- Returns:
- the quotechar
-
setQuotechar
public void setQuotechar(char quotechar)
- Parameters:
quotechar
- the quotechar to set
-
getEscapechar
public char getEscapechar()
- Returns:
- the escapechar
-
setEscapechar
public void setEscapechar(char escapechar)
- Parameters:
escapechar
- the escapechar to set
-
getLineSeparator
public String getLineSeparator()
- Returns:
- the lineSeparator
-
setLineSeparator
public void setLineSeparator(String lineSeparator)
- Parameters:
lineSeparator
- the lineSeparator to set
-
isQuoteAllFields
public boolean isQuoteAllFields()
- Returns:
- the quoteAllFields
-
setQuoteAllFields
public void setQuoteAllFields(boolean quoteAllFields)
- Parameters:
quoteAllFields
- the quoteAllFields to set
-
setWritePrj
public void setWritePrj(boolean booleanValue)
-
isWritePrj
public boolean isWritePrj()
-
-