public void load(String fileName) throws IOException, MaryConfigurationException {
  DataInputStream dis=null;
  try {
    dis=new DataInputStream(new BufferedInputStream(new FileInputStream(fileName)));
  }
 catch (  FileNotFoundException e) {
    throw new RuntimeException("File [" + fileName + "] was not found.");
  }
  try {
    hdr=new MaryHeader(dis);
    if (hdr.getType() != MaryHeader.SCOST) {
      throw new RuntimeException("File [" + fileName + "] is not a valid Mary Units file.");
    }
    numberOfUnits=dis.readInt();
    if (numberOfUnits < 0) {
      throw new RuntimeException("File [" + fileName + "] has a negative number of units. Aborting.");
    }
    sCost=new double[numberOfUnits];
    for (int i=0; i < numberOfUnits; i++) {
      sCost[i]=dis.readFloat();
    }
  }
 catch (  IOException e) {
    throw new RuntimeException("Reading the Mary header from file [" + fileName + "] failed.",e);
  }
}

public void load ( String fileName ) throws IOException , MaryConfigurationException { DataInputStream dis = null ; try { dis = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( fileName ) ) ) ; } catch ( FileNotFoundException e ) { throw new RuntimeException ( "File [" + fileName + "] was not found." ) ; } try { hdr = new MaryHeader ( dis ) ; if ( hdr . getType ( ) != MaryHeader . SCOST ) { throw new RuntimeException ( "File [" + fileName + "] is not a valid Mary Units file." ) ; } numberOfUnits = dis . readInt ( ) ; if ( numberOfUnits < 0 ) { throw new RuntimeException ( "File [" + fileName + "] has a negative number of units. Aborting." ) ; } sCost = new double [ numberOfUnits ] ; for ( int i = 0 ; i < numberOfUnits ; i ++ ) { sCost [ i ] = dis . readFloat ( ) ; } } catch ( IOException e ) { throw new RuntimeException ( "Reading the Mary header from file [" + fileName + "] failed." , e ) ; } }
load the given unit file
