The GRIB Java decoder works on a as needed approach to only convert the data that is requested therefore avoiding the large output file sizes. For efficiency, the raw GRIB file is indexed so the parameter information is in a ready available condensed format. The data accessing routines knows how to navigate the raw data file using the parameter offset to only extract the desired data, this makes for very efficient data extraction. If one wants to convert a Grib file completely to netCDF, then here is a Grib2Netcdf decoder in the netcdf-java package.
The GRIB Java decoder package consists of a set of utilities that also can act as templates for coders.
The Java Docs for the GRIB Java decoder will show the args needed for the above utilities and the APIs for the Grib library.
Currently the netCDF Java library uses the grib-version.jar library to read the Grib files and to make netCDF objects/files.