1 23 24 package com.sun.enterprise.cli.framework; 25 26 import java.io.InputStreamReader ; 27 import java.io.BufferedReader ; 28 import java.io.InputStream ; 29 import java.io.IOException ; 30 31 32 36 public class UserInput implements IUserInput 37 { 38 39 private InputStream mInputStr; 40 private boolean mInteractive; 41 private BufferedReader buffRead; 42 43 44 49 public UserInput(InputStream in) 50 { 51 mInputStr = in; 52 mInteractive = true; 53 buffRead = new BufferedReader (new InputStreamReader (mInputStr)); 54 } 55 56 57 60 public boolean isInteractive() 61 { 62 return mInteractive; 63 } 64 65 66 69 public void close() throws IOException 70 { 71 mInputStr.close(); 72 } 73 74 78 public void setEncoding(String sEncoding) throws IOException 79 { 80 InputStreamReader inStrReader = new InputStreamReader ( 82 mInputStr, sEncoding); 83 buffRead = new BufferedReader (inStrReader); 84 } 86 87 88 92 public String getLine() throws IOException 93 { 94 return buffRead.readLine(); 97 } 98 99 102 public int getChar() throws IOException 103 { 104 return buffRead.read(); 105 } 106 107 } 108 109 | Popular Tags |