Code example for StringBufferInputStream

0
public class Client { 
    private BufferedReader in;
    private BigDecimal result;
 
    public Client(String str) {
        in = new BufferedReader(new InputStreamReader(new StringBufferInputStream(str)));
    } 
    public Client() { 
        in = new BufferedReader(new InputStreamReader(System.in));
    } 
 
    public void run() { 
        String line = readLine();
        try { 
            ExpressionParser parser = new ExpressionParser(line);
            Expression expression = parser.getExpression();
            result = expression.getResult();
        } catch (InvalidNumericFormatException e) {
            System.out.println("Invalid input numeric format");
        } catch (DivideByZeroException e) {
            System.out.println("the second parameter in Divider can't be zero");