ADS File Reader is a small, tight Java library to make reading files in the ADS file format quick and easy. It grew out of a project where I had to use ADS files (which are the output files from exporting a dimension out of EPMA) to generate files to load into a different system. ADS File Reader is licensed under the Apache Software License version 2.0 and is available from the ADS File Reader public GitHub repository, where more information can be found about how to use it.

The main focus of the design of the library is to make reading incredibly easy. For example, given a file like this:

!VERSION=1.0 !Section=Dimensions
Scenario|Scenario|True|Text !Section=DimensionAssociations
Scenario|EndPeriod|Period !Members=Scenario

We can very, very easily parse through the data with a convenient API:

AdsContents scenario = AdsContents.create(“”);

for (Map<String, String> line : scenario.getSection("Section", "DimensionAssociations")) {
System.out.println("Line: " + line);

Which gives us the following result:

Line: {'BaseDimension=Scenario, Property=Alias, TargetDimension=Alias}
Line: {'BaseDimension=Scenario, Property=StartYear, TargetDimension=Year}
Line: {'BaseDimension=Scenario, Property=EndYear, TargetDimension=Year}
Line: {'BaseDimension=Scenario, Property=StartPeriod, TargetDimension=Period}
Line: {'BaseDimension=Scenario, Property=EndPeriod, TargetDimension=Period}

Note that the AdsContents object itself is Iterable, so we can easily go through all the sections, and the Section object is iterable, so we can go through all of the items in a section. The Map<String, String> is the header of the section combined with the line, so we don’t need to go through the trouble of pairing things up manually. The small, lightweight API takes care of all the grunt work for us. 

There are many more convenience functions available, particularly regarding getting information about a particular section, getting values of parameters in the header, and so on. If you need to read through an ADS file for some reason, I hope you find this useful. Let me know if you have any issues, need any support, or just plain end up using it!

2 thoughts on “ADS File Reader

  1. Aichetou Cheikh Moham

    je dois parcourir les fichier ads pour créer des dimension j’ai besoin tout d’abord des entêtes de chaque section?

Leave a Reply

Your email address will not be published.