1 package org.cyclopsgroup.jmxterm.io; 2 3 /** 4 * General abstract class to output message and values 5 * 6 * @author <a href="mailto:jiaqi.guo@gmail.com">Jiaqi Guo</a> 7 */ 8 public abstract class CommandOutput { 9 /** 10 * Close the output; 11 */ 12 public void close() {} 13 14 /** 15 * Print out value to output without line break 16 * 17 * @param output Value to print out 18 */ 19 public abstract void print(String output); 20 21 /** 22 * @param e Error to print out 23 */ 24 public abstract void printError(Throwable e); 25 26 /** 27 * Print out value to output as standalone line 28 * 29 * @param output Value to print out 30 */ 31 public void println(String output) { 32 print(output); 33 print(System.lineSeparator()); 34 } 35 36 /** 37 * Print message to non-standard console for human to read. New line is always appended 38 * 39 * @param message Message to print out. 40 */ 41 public abstract void printMessage(String message); 42 }