Fluent

The Fluent API is designed to simplify the process of chaining processors, connecting operators, and disposing of resources. It has built in support for shimming Line operators to work with Row data. It uses sensible defaults, and will auto convert between Line and Row where possible. As illustrated in Basics.Processors, manually coding these steps can be tedious.
Use the Pnyx class to access the Fluent API. It uses state-base logic for wiring together sources, filters, transforms, buffering, and destinations. You can learn more about the internal State Machine, but can be ignored for simple projects. At a high level, the state-machine permits method calls in the following sequence:
  • Input - 1 call for reading input
  • Line - any number of calls for operation on Line data, which is assumed input
  • Row - any number of calls for operation on Row data, but only after converting from Line
  • Output - 1 call for writing
There are a couple of import details. Line and Row operations can be mixed and matched, so long as a conversion is used, like parseCsv to convert to Row or print to convert to Line. For input and output, Pnyx expects only 1 call. However, it supports multiple inputs via the cat method, and multiple outputs via the tee method.

Builder Pattern

Most of the methods on Pnyx return the Pnyx object, which makes method chaining simple.
using (var p = new Pnyx())
    p.readString("a,b,c,d")
     .parseCsv()
     .print("$4|$3|$2|$1")
     .writeStdout();

// outputs: d|c|b|a

Next

Suggested next step:
  • Reference, explore all methods of Pnyx
  • Line, examples of Line operations
  • Row, examples of Row operations