Class CSVStrategy

Object
CSVStrategy
Direct Known Subclasses:
CSVAttributesOnlyStrategy, CSVLatLonStrategy, CSVSpecifiedWKTStrategy

public abstract class CSVStrategy extends Object
  • Field Details

  • Constructor Details

    • CSVStrategy

      public CSVStrategy(CSVFileState csvFileState)
  • Method Details

    • 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()