X9Writer is a high level I/O interface which can be used to create an x9 file on an item by item basis. It includes methods to open the output x9 file, add an item with optional addendums, add type 68 user records of your design, and to then close the output x9 file. X9Writer can be used to create ICL (forward presentment) files or ICLR (return item) files.
The power of X9Writer comes from its ability to control the format and and header record values from either internal or external sources. This design allows an x9 file to be created per the requirements of the receiving financial institution without having to hard-wire those definitions within your application program. X9Writer allows these parameters to be assigned from an external XML file which allows all x9 attributes to be easily defined and manipulated. X9HeaderXml control fields various field level formatting and populates values for the file header, cash letter header, and bundle header records. This facility contained a large number of attributes which control the overall creation of the output x9 file. X9HeaderXml values can also be overriden using setter methods.
You can optionally include addendums using this interface,should you have that requirement. Individual addendums are created as an array of fields which are added to the item prior to being written. By attaching the addendums to the item, the addendum count can be queried by X9Writer and included in the type 25 or type 31 record.
Items can be presented in on of several ways. First you can provide a CSV array of the fields that explicitly define the new item (eg, an array of fields for a type 25 record). This approach gives you very detailed control over the x9 item record that is created. A second approach is to populate an X9Item object and provide that to X9Writer. This can be an easier approach and has the advantage that X9Item can be directly populated from either an x9object or can be set from your x9 data including MICR line parse.
X9Writer controls item level batching and totals are automatically accumulated and used to populate the appropriate records and fields in the x9 trailer records.
Refer to the X9DemoWriter example program which further highlights the use of X9Writer.