示例#1
0
 private static InputStream readFromHDFS(
     FileSystem fs, String name, URI uri, ApplicationSpec appSpec, ApplicationId appId)
     throws Exception {
   // will throw exception if the file name is without extension
   String extension = uri.getPath().substring(uri.getPath().lastIndexOf(".") + 1);
   String pathSuffix = appSpec.getAppName() + "/" + appId.getId() + "/" + name + "." + extension;
   Path dst = new Path(fs.getHomeDirectory(), pathSuffix);
   return fs.open(dst).getWrappedStream();
 }