title: Spark - Read file in byte format as InputStream
body: <p>how can i read multiple  files , in byte array format , as input stream in a spark job?</p>
  
  <pre><code>Path pt = new Path(umfPaths);           
  FileSystem fs = FileSystem.get(jsc.hadoopConfiguration());
  fs.open(pt);
  </code></pre>
  
  <p>.. The reason is I have inputfiles whose contents is in byte format . The input file is then split into multiple files with blocklength size as 64 MB and stored in HDFS. I have to parallel process the files using Apache spark . The req is to read one entire block of 64MB as a single file and process it . Is it efficient to process by writing a custom record reader or use the FileSystem API's (using InputStream) to read each file ? </p>