Updated Java API to match the current C++ API.