ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [01/50] [abbrv] incubator-ignite git commit: # ignite-185 Change batch file reading.
Date Tue, 10 Mar 2015 07:02:38 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-414 e71787234 -> 3c4f9ffad


# ignite-185 Change batch file reading.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b7747043
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b7747043
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b7747043

Branch: refs/heads/ignite-414
Commit: b774704366d72a353e476d9120f53caf37851ad2
Parents: 0149a0d
Author: anovikov <anovikov@gridgain.com>
Authored: Thu Mar 5 21:45:28 2015 +0700
Committer: anovikov <anovikov@gridgain.com>
Committed: Thu Mar 5 21:45:28 2015 +0700

----------------------------------------------------------------------
 .../apache/ignite/visor/commands/VisorConsole.scala  | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7747043/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
index 6ee7478..8cc1895 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
@@ -27,7 +27,8 @@ import java._
 import java.awt.Image
 import java.io._
 import java.text.SimpleDateFormat
-import java.util._
+
+import scala.io._
 
 // Built-in commands.
 // Note the importing of implicit conversions.
@@ -118,7 +119,7 @@ object VisorConsole extends App {
         visor.quit()
     }
 
-    var batchStream: Option[InputStream] = None
+    var batchStream: Option[String] = None
 
     batchFile.foreach(name => {
         val f = U.resolveIgnitePath(name)
@@ -132,17 +133,13 @@ object VisorConsole extends App {
             visor.quit()
         }
 
-        batchStream = Some(new FileInputStream(f))
+        batchStream = Some(Source.fromFile(f).getLines().mkString("\n"))
     })
 
-    batchCommand.foreach(commands =>
-        batchStream = Some(new ByteArrayInputStream(commands.replaceAll(";", "\n").getBytes("UTF-8"))))
+    batchCommand.foreach(commands => batchStream = Some(commands.replaceAll(";", "\n")))
 
     val inputStream = batchStream match {
-        case Some(stream) =>
-            new SequenceInputStream(Collections.enumeration(util.Arrays.asList(stream,
-                new ByteArrayInputStream("\nquit\n".getBytes("UTF-8")))))
-
+        case Some(cmd) => new ByteArrayInputStream((cmd + "\nquit\n").getBytes("UTF-8"))
         case None => new FileInputStream(FileDescriptor.in)
     }
 


Mime
View raw message