DEADSOFTWARE

Mirror gpcp-32255
[gpcp-linux.git] / libs / java / StdIn.java
1 //
2 // Body of StdIn interface.
3 // This file implements the code of the StdIn.cp file.
4 // kjg June 2004.
6 package CP.StdIn;
8 import java.io.*;
10 public class StdIn
11 {
12 private static BufferedReader rdr =
13 new BufferedReader(new InputStreamReader(System.in));
15 public static void ReadLn(char[] arr) throws IOException {
16 String str = rdr.readLine();
17 if (str == null) {
18 arr[0] = '\0'; return;
19 }
20 int len = arr.length;
21 int sLn = str.length();
22 len = (sLn < len ? sLn : len-1);
23 str.getChars(0, len, arr, 0);
24 arr[len] = '\0';
25 }
27 public static char Read() throws IOException
28 {
29 return (char)rdr.read();
30 }
32 public static boolean More() throws IOException
33 {
34 return true; // temporary fix until we figure out
35 // return rdr.ready(); // how to get the same semantics for
36 } // .NET and the JVM (kjg Sep. 2004)
38 public static void SkipLn() throws IOException
39 {
40 String str = rdr.readLine(); // and discard str
41 }
43 } // end of public class StdIn