Utilities

Pnyx has several utilities that are used internally, but can be used with any project. Most can be found in the util package. Feel free to use these in your project(s). Most of the classes were built to help parse and transform files from various medical systems, which are known for their lack of interoperability. Of course, parsing names, zip-codes and phone numbers can be used for any type of data file.
Unlike the rest of Pnyx, these utilities are undocumented. If you're interested in learning more about them, it is recommended to view their Unit Test. Most methods are either self-explanatory, or have good test coverage. Usage of the methods can be ascertained from the data within the test cases.

CsvReader

One utility that might be useful, is CsvReader. It is used internally for Row sorting. The following example shows how to use for general purpose CSV parsing.
using (FileStream stream = new FileStream("my.csv", FileMode.Open, FileAccess.Read))
{
    using (CsvReader reader = new CsvReader(stream, Encoding.UTF8))
    {
        reader.setStrict(true); // throw errors for bad formatting
        
        List<String> row;
        while ((row = reader.readRow()) != null)
        {
            // Process data
            Console.WriteLine("Row has {0} column(s)", row.Count);
        }
    }
}

CsvWriter

Another utility that might be useful, is CsvWriter. It is used internally for Row sorting. The following example shows how to use for general purpose CSV writing.
using (var stream = new FileStream("o.csv", FileMode.Create, FileAccess.Write))
{
    using (CsvWriter writer = new CsvWriter(stream, Encoding.UTF8))
    {
        int counter = 0;
        List<String> row = new List<String>();                        
        for (int i = 0; i < 200; i++)
        {
            row.Clear();
            for (int j = 0; j < 5; j++)
                row.Add(counter++.ToString());

            writer.writeRow(row);
        }
    }
}

Next

Suggested next steps:
  • CMD, learn more about running from CommandLine
  • Software, learn about licensing and how to contribute.