Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add minor code change

...

HDFS URI

HDFS URI are like that : hdfs://namenodedns:port/user/hdfs/folder/file.csv

Default port is 8020.

Init HDFS FileSystem Object

...

Code Block
languagejava
//==== Read file
logger.info("Read file into hdfs");
//Create a path
Path hdfsreadpath = new Path(newFolderPath + "/" + fileName);
//Init input stream
FSDataInputStream inputStream = fs.open(hdfsreadpath);
//Classical input stream usage
String out= IOUtils.toString(inputStream, "UTF-8");
logger.info(out);
inputStream.close();
fs.close();