public static boolean print ( String command , Writer out , ucar . nc2 . util . CancelTask ct ) throws IOException { // pull out the filename from the command String filename ; StringTokenizer stoke = new StringTokenizer ( command ) ; if ( stoke . hasMoreTokens ( ) ) filename = stoke . nextToken ( ) ; else { out . write ( usage ) ; return false ; } try ( NetcdfFile nc = NetcdfDataset . openFile ( filename , ct ) ) { // the rest of the command int pos = command . indexOf ( filename ) ; command = command . substring ( pos + filename . length ( ) ) ; return print ( nc , command , out , ct ) ; } catch ( java . io . FileNotFoundException e ) { out . write ( "file not found= " ) ; out . write ( filename ) ; return false ; } finally { out . close ( ) ; } }
ncdump that parses a command string .