The GridUtility methods presented here provide a simple pair of calls for retrieving or storing GridData objects one-at-a-time from or to records in a DSS file. In addition to these methods, the heclib.grid package contains a GriddedData class that inherits from HecDataManager, which is better suited for repeated reading and writing because of its more complete set of tools for manipulating DSS path names and management of connections to DSS files.

GridUtilities.StoreGridToDSS


This method takes a DSS file name, a DSS path, and a GridData object as arguments and returns an integer value indicating the success or failure of the attempt to store the grid.

int GridUtilities.storeGridToDss(
String DssFileName,
String DssPath,
GridData theGrid)
JAVA


The date fields in the DSS path will be re-set to the values contained in the GridInfo object contained within the GridData object given as an argument. The possible return values and their meanings are listed below.

statusdescription
0Grid successfully written to the DSS file.
-1The DssPath string cannot be converted to a valid path.
-2Unable to write to the DSS file.


GridUtilities.RetrieveGridFromDSS

This method takes a DSS file name, a DSS path, and an array of integers as arguments and returns a GridData object. The integer array can contain a single integer, which will be set to indicate the success or failure of the attempt to read the grid from the DSS file.

GridData GridUtilities.retrieveGridFromDss(
                   String DssFileName,
                       String DssPath,
                         int[] status)
JAVA

The DSS file must exist, and the DSS path argument must exactly match a path in the DSS file. The possible return values and their meanings are listed below. If the attempt to read the grid fails, the GridData returned by the method is a null pointer. \\ A status value is returned as the first element in the status array. (The status array only needs to contain one integer.) The meanings of the values in status[0] are listed below.

statusdescription
0Grid successfully read from the DSS file
-1The DSS File does not exist or cannot be read
-2The path cannot be found in the DSS file
-3The record was retrieved, but is not a grid.