val thePath = new Path(theHdfsPath)
val hdfs = org.apache.hadoop.fs.FileSystem.get(
new java.net.URI(THE_MASTER_URI),
new org.apache.hadoop.conf.Configuration())
val writer = new PrintWriter(hdfs.create(thePath))
writer.println("toWriteString") // 或者 writer.append(toWriteString)
writer.close()