@Override
  public String getField(Type type, String id, String key) {
    BufferedReader in = null;
    Path p = new Path(getPath(type) + "/" + id + "/" + key);
    try {
      if(!fs.exists(p)) {
        //check first, otherwise webhcat.log is full of stack traces from FileSystem when
        //clients check for status ('exitValue', 'completed', etc.)
        LOG.debug(p + " does not exist.");
        return null;
      }
      in = new BufferedReader(new InputStreamReader(fs.open(p)));
      String line = null;
      String val = "";
      while ((line = in.readLine()) != null) {
        if (!val.equals("")) {
          val += "\n";
        }
        val += line;
      }
      return val;
    } catch (Exception e) {
      LOG.error("Couldn't find " + p + ": " + e.getMessage(), e);
    } finally {
      close(in);
    }
    return null;
  }
HDFS implementation of templeton storage.

 This implementation assumes that all keys in key/value pairs are
 chosen such that they don't have any newlines in them.
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/HDFSStorage.java