1 55 package org.lateralnz.common.cli; 56 57 import java.io.BufferedReader ; 58 import java.io.IOException ; 59 import java.io.OutputStream ; 60 61 public class CLStdIOHandler implements CLIOHandler { 62 63 private String prompt = ">"; 64 65 public void write(OutputStream out, String message, boolean doPrompt) throws IOException { 66 write(out, (message).getBytes()); 67 if (doPrompt) { 68 write(out, (prompt + " ").getBytes()); 69 } 70 } 71 72 public void write(OutputStream out, byte[] b) throws IOException { 73 for (int i = 0; i < b.length; i++) { 74 out.write(b[i]); 75 } 76 77 out.flush(); 78 } 79 80 public String read(BufferedReader in) throws IOException { 81 return in.readLine(); 82 } 83 84 public void setEcho(OutputStream out, boolean echo) throws IOException { 85 } 86 87 public void setPrompt(String prompt) { 88 this.prompt = prompt; 89 } 90 91 } 92 | Popular Tags |