Java API and example

This is a first stab at a Java API. I'd like to validate the approach before adding more thorough testing and  documentation.
(test and doc are obvious TODO items)