Class DataTools

java.lang.Object
edu.pitt.isp.sverchkov.data.DataTools

public class DataTools extends Object
Data tools.
Version:
$Id: $Id
Author:
YUS24
  • Field Details

    • NEWLINE

      public static final String NEWLINE
      Constant NEWLINE="System.getProperty(line.separator)"
    • DELIMITER_REGEX

      public static final String DELIMITER_REGEX
      Constant DELIMITER_REGEX=" *, *"
      See Also:
    • DELIMITER

      public static final String DELIMITER
      Constant DELIMITER=", "
      See Also:
  • Method Details

    • dataTableFromFile

      public static DataTable<String,String> dataTableFromFile(File file) throws FileNotFoundException
      Reads a data table from a file.
      Parameters:
      file - The file to read from
      Returns:
      The data table
      Throws:
      FileNotFoundException - if the file is not found
    • saveCSV

      public static <Attribute, Value> void saveCSV(DataTable<Attribute,Value> data, File dest, boolean headers) throws IOException
      Saves a data table to a file.
      Type Parameters:
      Attribute - a Attribute class
      Value - a Value class
      Parameters:
      data - The data table to save
      dest - The file to save to
      headers - Whether to include headers
      Throws:
      IOException - if something goes wrong