public String readScript(String fname) throws IOException {
  StringBuilder sb=new StringBuilder();
  BufferedReader in=null;
  try {
    if (fname.startsWith("hdfs:") || fname.startsWith("gpfs:")) {
      FileSystem fs=FileSystem.get(ConfigurationManager.getCachedJobConf());
      Path scriptPath=new Path(fname);
      in=new BufferedReader(new InputStreamReader(fs.open(scriptPath)));
    }
 else {
      in=new BufferedReader(new FileReader(fname));
    }
    String tmp=null;
    while ((tmp=in.readLine()) != null) {
      sb.append(tmp);
      sb.append("\n");
    }
  }
  finally {
    IOUtilFunctions.closeSilently(in);
  }
  return sb.toString();
}

public String readScript ( String fname ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; BufferedReader in = null ; try { if ( fname . startsWith ( "hdfs:" ) || fname . startsWith ( "gpfs:" ) ) { FileSystem fs = FileSystem . get ( ConfigurationManager . getCachedJobConf ( ) ) ; Path scriptPath = new Path ( fname ) ; in = new BufferedReader ( new InputStreamReader ( fs . open ( scriptPath ) ) ) ; } else { in = new BufferedReader ( new FileReader ( fname ) ) ; } String tmp = null ; while ( ( tmp = in . readLine ( ) ) != null ) { sb . append ( tmp ) ; sb . append ( "\n" ) ; } } finally { IOUtilFunctions . closeSilently ( in ) ; } return sb . toString ( ) ; }
read a dml or pydml file as a string .
