public void load(String fileName) throws IOException, MaryConfigurationException {
  DataInputStream dis=new DataInputStream(new BufferedInputStream(new FileInputStream(fileName)));
  hdr=new MaryHeader(dis);
  if (hdr.getType() != MaryHeader.UNITS) {
    throw new MaryConfigurationException("File [" + fileName + "] is not a valid Mary Units file.");
  }
  numberOfUnits=dis.readInt();
  if (numberOfUnits < 0) {
    throw new MaryConfigurationException("File [" + fileName + "] has a negative number of units. Aborting.");
  }
  sampleRate=dis.readInt();
  if (sampleRate < 0) {
    throw new MaryConfigurationException("File [" + fileName + "] has a negative number sample rate. Aborting.");
  }
  units=new Unit[numberOfUnits];
  for (int i=0; i < numberOfUnits; i++) {
    long startTime=dis.readLong();
    int duration=dis.readInt();
    units[i]=new Unit(startTime,duration,i);
  }
}

public void load ( String fileName ) throws IOException , MaryConfigurationException { DataInputStream dis = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( fileName ) ) ) ; hdr = new MaryHeader ( dis ) ; if ( hdr . getType ( ) != MaryHeader . UNITS ) { throw new MaryConfigurationException ( "File [" + fileName + "] is not a valid Mary Units file." ) ; } numberOfUnits = dis . readInt ( ) ; if ( numberOfUnits < 0 ) { throw new MaryConfigurationException ( "File [" + fileName + "] has a negative number of units. Aborting." ) ; } sampleRate = dis . readInt ( ) ; if ( sampleRate < 0 ) { throw new MaryConfigurationException ( "File [" + fileName + "] has a negative number sample rate. Aborting." ) ; } units = new Unit [ numberOfUnits ] ; for ( int i = 0 ; i < numberOfUnits ; i ++ ) { long startTime = dis . readLong ( ) ; int duration = dis . readInt ( ) ; units [ i ] = new Unit ( startTime , duration , i ) ; } }
load the given unit file
