Documentation of 'Catalano.IO.CSVParser' Java class
CSVParser
Catalano.IO

Class CSVParser



  • public class CSVParser
    extends java.lang.Object
    CSV Parser, handle csv files.
    • Constructor Summary

      Constructors 
      Constructor and Description
      CSVParser()
      Initialize a new instance of the CSVParser class.
      CSVParser(char delimiter)
      Initialize a new instance of the CSVParser class.
      CSVParser(char delimiter, int startRow)
      Initialize a new instance of the CSVParser class.
      CSVParser(char delimiter, int startRow, int startColumn)
      Initialize a new instance of the CSVParser class.
      CSVParser(char delimiter, int startRow, int startColumn, int endColumn)
      Initialize a new instance of the CSVParser class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      char getDelimiter()
      Get the delimiter.
      int getEndColumn()
      Get end column index.
      java.lang.String getNewLine()
      Get new line separator.
      int getStartColumn()
      Get start column index.
      int getStartRow()
      Get start row index.
      java.lang.String[][] Read(java.lang.String filename)
      Read CSV.
      <T> java.util.List<T> Read(java.lang.String filename, java.lang.Class clazz)
      Read CSV and convert to object type.
      double[][] ReadAsDouble(java.lang.String filename) 
      int[][] ReadAsInt(java.lang.String filename) 
      void setDelimiter(char delimiter)
      Set the delimiter.
      void setEndColumn(int endCol)
      Set end column index.
      void setNewLine(java.lang.String newLine)
      Set new line separator.
      void setStartColumn(int startCol)
      Set start column index.
      void setStartRow(int startRow)
      Set start row index.
      void Write(double[][] data, java.lang.String filename) 
      void Write(double[][] data, java.lang.String filename, int decimalPlaces)
      Write the matrix of integer in csv file format.
      void Write(int[][] data, java.lang.String filename)
      Write the matrix of integer in csv file format.
      void Write(java.lang.String[][] data, java.lang.String filename)
      Write the matrix of string in csv file format.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CSVParser

        public CSVParser()
        Initialize a new instance of the CSVParser class.
      • CSVParser

        public CSVParser(char delimiter)
        Initialize a new instance of the CSVParser class.
        Parameters:
        delimiter - Delimiter.
      • CSVParser

        public CSVParser(char delimiter,
                         int startRow)
        Initialize a new instance of the CSVParser class.
        Parameters:
        delimiter - Delimiter.
        startRow - Start row.
      • CSVParser

        public CSVParser(char delimiter,
                         int startRow,
                         int startColumn)
        Initialize a new instance of the CSVParser class.
        Parameters:
        delimiter - Delimiter.
        startRow - Start row.
        startColumn - Start column.
      • CSVParser

        public CSVParser(char delimiter,
                         int startRow,
                         int startColumn,
                         int endColumn)
        Initialize a new instance of the CSVParser class.
        Parameters:
        delimiter - Delimiter.
        startRow - Start row.
        startColumn - Start column.
        endColumn - End column.
    • Method Detail

      • getDelimiter

        public char getDelimiter()
        Get the delimiter.
        Returns:
        Delimiter.
      • setDelimiter

        public void setDelimiter(char delimiter)
        Set the delimiter.
        Parameters:
        delimiter - Delimiter.
      • getNewLine

        public java.lang.String getNewLine()
        Get new line separator.
        Returns:
        New line separator.
      • setNewLine

        public void setNewLine(java.lang.String newLine)
        Set new line separator.
        Parameters:
        newLine - New line separator.
      • getStartRow

        public int getStartRow()
        Get start row index.
        Returns:
        Start row index.
      • setStartRow

        public void setStartRow(int startRow)
        Set start row index.
        Parameters:
        startRow - Start row index.
      • getStartColumn

        public int getStartColumn()
        Get start column index.
        Returns:
        Start column index.
      • setStartColumn

        public void setStartColumn(int startCol)
        Set start column index.
        Parameters:
        startCol - Start column index.
      • getEndColumn

        public int getEndColumn()
        Get end column index. Default: -1, It means to get all columns.
        Returns:
      • setEndColumn

        public void setEndColumn(int endCol)
        Set end column index. Value: -1 for to set the last column.
        Parameters:
        endCol - End column index.
      • Read

        public <T> java.util.List<T> Read(java.lang.String filename,
                                          java.lang.Class clazz)
        Read CSV and convert to object type. The method find the constructor that contains the maximum parameters.
        Type Parameters:
        T - Object type.
        Parameters:
        filename - CSV filename.
        clazz - Object type.
        Returns:
        List of user definied type.
      • Read

        public java.lang.String[][] Read(java.lang.String filename)
        Read CSV.
        Parameters:
        filename - Filename.
        Returns:
        CSV table of string.
      • ReadAsDouble

        public double[][] ReadAsDouble(java.lang.String filename)
      • ReadAsInt

        public int[][] ReadAsInt(java.lang.String filename)
      • Write

        public void Write(java.lang.String[][] data,
                          java.lang.String filename)
        Write the matrix of string in csv file format.
        Parameters:
        data - Data.
        filename - Filename.
      • Write

        public void Write(int[][] data,
                          java.lang.String filename)
        Write the matrix of integer in csv file format.
        Parameters:
        data - Data.
        filename - Filename.
      • Write

        public void Write(double[][] data,
                          java.lang.String filename)
      • Write

        public void Write(double[][] data,
                          java.lang.String filename,
                          int decimalPlaces)
        Write the matrix of integer in csv file format.
        Parameters:
        data - Data.
        filename - Filename.

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.