cdm/src/main/java/ucar/nc2/NCdumpW.java
public static boolean print(String filename, Writer out, boolean showAll, boolean showCoords, boolean ncml,
          boolean strict, String varNames, ucar.nc2.util.CancelTask ct) throws IOException {
    try (NetcdfFile nc = NetcdfDataset.openFile(filename, ct)){
      return print(nc, out, showAll, showCoords, ncml, strict, varNames, ct);

    } catch (java.io.FileNotFoundException e) {
      out.write("file not found= ");
      out.write(filename);
      out.flush();
      return false;

    }
  }
public static boolean print(String filename, Writer out, boolean showAll, boolean showCoords, boolean ncml,
          boolean strict, String varNames, ucar.nc2.util.CancelTask ct) throws IOException {
    try (NetcdfFile nc = NetcdfDataset.openFile(filename, ct)){
      return print(nc, out, showAll, showCoords, ncml, strict, varNames, ct);

    } catch (java.io.FileNotFoundException e) {
      out.write("file not found= ");
      out.write(filename);
      out.flush();
      return false;

    }
  }
ncdump-like print of netcdf file.

@param filename   NetcdfFile to open
@param out        print to this stream
@param showAll    dump all variable data
@param showCoords only print header and coordinate variables
@param ncml       print NcML representation (other arguments are ignored)
@param strict     print strict CDL representation
@param varNames   semicolon delimited list of variables whose data should be printed
@param ct         allow task to be cancelled; may be null.
@return true if successful
@throws IOException on write error