Skip to content

mpobjects/sofalife

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Maven Central Sonatype Nexus (Snapshots)

sofalife

Reader for Structured Fixed Length Formats

Sofalife is a Java library to process text files which have a structured fixed length format. Fixed length files are column based, like CSV. In some cases a file is used where lines can have different record types with different definitions, and possibly a hierarchy in elements. Standard fixed length parsers are therefore not usable to process these file.

This library only exist in order to cope with these kinds of horrible formats. Please do not define your own format which can be handled by this library, make use of the various properly structured text formats like XML, JSON, or YAML.

Format Specification

The format to read is specified by a XML file according to the XML Schema defined in sofalife.xsd.

An example specification is available in the source.

Usage

// Load the specification file
FormatSpec spec = new SpecLoader().load(inputStream);

// Create a converter from the flat file to a XML file
XmlConverter xmlConverter = new XmlConverter(spec);

// Convert the file
xmlConverter.convert(inputStream, outputWriter)

About

Reader for Structured Fixed Length Formats

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published