Repository: incubator-griffin Updated Branches: refs/heads/master a414f4bcb -> 93930b816
removed the duplicate hdfs util Author: Lionel Liu <[email protected]> Closes #271 from bhlx3lyx7/tmst. Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/93930b81 Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/93930b81 Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/93930b81 Branch: refs/heads/master Commit: 93930b816c354b1b98d93fc05367f952323f9dcd Parents: a414f4b Author: Lionel Liu <[email protected]> Authored: Fri Apr 27 10:31:38 2018 +0800 Committer: Lionel Liu <[email protected]> Committed: Fri Apr 27 10:31:38 2018 +0800 ---------------------------------------------------------------------- .../griffin/measure/utils/HdfsUtils.scala | 54 -------------------- 1 file changed, 54 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/93930b81/measure/src/main/scala/org/apache/griffin/measure/utils/HdfsUtils.scala ---------------------------------------------------------------------- diff --git a/measure/src/main/scala/org/apache/griffin/measure/utils/HdfsUtils.scala b/measure/src/main/scala/org/apache/griffin/measure/utils/HdfsUtils.scala deleted file mode 100644 index bd7611f..0000000 --- a/measure/src/main/scala/org/apache/griffin/measure/utils/HdfsUtils.scala +++ /dev/null @@ -1,54 +0,0 @@ -package org.apache.griffin.util - -import java.io.File - -import org.apache.hadoop.conf.Configuration -import org.apache.hadoop.fs.{FSDataInputStream, FSDataOutputStream, FileSystem, Path} - -object HdfsUtils { - - private val conf = new Configuration() - - private val dfs = FileSystem.get(conf) - - def createFile(filePath: String): FSDataOutputStream = { - return dfs.create(new Path(filePath)) - } - - def openFile(filePath: String): FSDataInputStream = { - return dfs.open(new Path(filePath)) - } - - def writeFile(filePath: String, message: String): Unit = { - val out = createFile(filePath) - out.write(message.getBytes("utf-8")) - closeFile(out) - } - - /** - * Close inputStream or outputStream - */ - def closeFile(stream:Object): Unit = { - stream match{ - case inputObj:FSDataInputStream => { - try{ - stream.asInstanceOf[FSDataInputStream].close() - }catch{ - case e:Exception=>e.printStackTrace() - } - } - case outputObj:FSDataOutputStream => { - try{ - stream.asInstanceOf[FSDataOutputStream].close() - }catch{ - case e:Exception=>{ - e.printStackTrace() - } - } - } - case _ => println("wrong object type,it not closable object!") - } - } - - -}
