Class CSVSampler

java.lang.Object
com.logicaldoc.core.PersistentObject
All Implemented Interfaces:
Closeable, Serializable, AutoCloseable

@Entity public class CSVSampler extends StreamSampler
A StreamSampler that reads the contents of a CSV file extracting all the rows as string arrays.
Expected format of each resource is this one:
  5.1,3.5,1.4,.2,"Setosa"
  7,3.2,4.7,1.4,"Versicolor"
  6.2,3.4,5.4,2.3,"Virginica"
 
This example will produce three rows of 5 elements each:
  5.1, 3.5, 1.4, .2, Setosa
  7, 3.2, 4.7, 1.4, Versicolor
  6.2, 3.4, 5.4, 2.3, Virginica
 
Since:
9.2
Author:
Marco Meschieri - LogicalDOC
See Also:
  • Constructor Details

    • CSVSampler

      public CSVSampler()
    • CSVSampler

      public CSVSampler(String name)
    • CSVSampler

      public CSVSampler(InputStream stream)
  • Method Details

    • getDelimiter

      public String getDelimiter()
    • setDelimiter

      public void setDelimiter(String delimiter)
    • getQuote

      public String getQuote()
    • setQuote

      public void setQuote(String quote)
    • getCategoryIndex

      public int getCategoryIndex()
    • setCategoryIndex

      public void setCategoryIndex(int categoryIndex)
    • collect

      public Sampling collect() throws IOException
      Description copied from class: Sampler
      Collects a list of samples
      Specified by:
      collect in class Sampler
      Returns:
      The iterator over the samples
      Throws:
      IOException - I/O Error
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Sampler
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Sampler