public BufferedReader open ( String fileName ) throws IOException { Path filePath = new Path ( fileName ) ; if ( ! hadoopFs . exists ( filePath ) ) { throw new IOException ( fileName + " does not exist in HDFS" ) ; } BufferedReader br = new BufferedReader ( new InputStreamReader ( hadoopFs . open ( filePath ) ) ) ; return br ; }
Finds the file with the specified name and returns a reader for that files contents .