DMelt:IO/6 EDN File Format

From jWork.ORG
Jump to: navigation, search
Limitted access. Reguest membership or login to this link first if you are already a member

EDN file format

DataMelt includes library to handle extensible data notation format. The EDN format is described in EDN web page. The included implementation is based on the edn-java gitlab. The Java API can be found in us.bpsm.edn.parser.package-summary.

The EDN files can hold any Java and Python object in a form of simple text files. The files are typically smaller then similar XML files since no tags is used. This feature make EDM files attractive to keep numeric data.

For example, Java ArrayList or Python list will be written to the text file exactly it should look:


You can also write lists, maps (dictionaries) to external files in arbitrary order. Then you can read such text files back, creating Java lists (Python lists) on the fly.

This is an example of parsing EDN string messages:

This is an example:

Now let us consider a complete example: We create Java list, Python list, Java map, Python dictionary, fill them and write all these objects sequentially into a file. Then we read the encoded objects back, creating on the fly lists, maps and dictionaries:

You can use this class to help with parsing the file:

pbr = Parsers.newParseable(IOUtil.stringFromResource("us/bpsm/edn/edn-sample.txt"))

Read this using us.bpsm.edn.parser.IOUtil API.

More information on this topic is in DMelt books