Revision: 5
http://coliut.svn.sourceforge.net/coliut/?rev=5&view=rev
Author: ronaldmaas
Date: 2008-05-24 05:34:43 -0700 (Sat, 24 May 2008)
Log Message:
-----------
Add coliut input class
Added Paths:
-----------
client/ColiutInput.java
Added: client/ColiutInput.java
===================================================================
--- client/ColiutInput.java (rev 0)
+++ client/ColiutInput.java 2008-05-24 12:34:43 UTC (rev 5)
@@ -0,0 +1,40 @@
+// Class to read a string from the input
+//
+// Copyright (C) 2008 Ronald Maas <ron...@us...>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+import java.io.*;
+
+public class ColiutInput
+{
+
+ public static String getInput(String prompt)
+ {
+ BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
+ String input;
+
+ System.out.print(prompt + ": ");
+ try
+ {
+ input = in.readLine();
+ } catch (Exception ex)
+ {
+ input = "";
+ }
+ return input;
+ }
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|