public static String readFile(HdfsApi hdfs, String filePath) throws HdfsApiException {
    FSDataInputStream stream;
    try {
      stream = hdfs.open(filePath);
      return IOUtils.toString(stream);
    } catch (IOException e) {
      throw new HdfsApiException("HDFS060 Could not read file " + filePath, e);
    } catch (InterruptedException e) {
      throw new HdfsApiException("HDFS061 Could not read file " + filePath, e);
    }
  }
Read string from file
@param filePath path to file
contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsUtil.java