org.apache.qpid.tools.utils
Class SimpleConsole

java.lang.Object
  extended by org.apache.qpid.tools.utils.SimpleConsole
All Implemented Interfaces:
Console

public class SimpleConsole
extends Object
implements Console


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.qpid.tools.utils.Console
Console.CellFormat
 
Field Summary
protected  BufferedReader _consoleReader
          Console Reader.
protected  BufferedWriter _consoleWriter
          Console Writer.
protected  CommandParser _parser
          Parser for command-line input.
 
Fields inherited from interface org.apache.qpid.tools.utils.Console
ROW_DIVIDER
 
Constructor Summary
SimpleConsole(BufferedWriter writer, BufferedReader reader)
           
 
Method Summary
 void close()
           
 void displayList(boolean hasTitle, String... list)
          Prints the list of String nicely.
 CommandParser getCommandParser()
           
 void print(String... message)
           
 void println(String... message)
           
 void printMap(String title, List<List> entries)
          Prints the list of String nicely.
 String[] readCommand()
          Reads and parses the command line.
 String readln()
           
 void setCommandParser(CommandParser parser)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_consoleWriter

protected BufferedWriter _consoleWriter
Console Writer.


_consoleReader

protected BufferedReader _consoleReader
Console Reader.


_parser

protected CommandParser _parser
Parser for command-line input.

Constructor Detail

SimpleConsole

public SimpleConsole(BufferedWriter writer,
                     BufferedReader reader)
Method Detail

print

public void print(String... message)
Specified by:
print in interface Console

println

public void println(String... message)
Specified by:
println in interface Console

readln

public String readln()
Specified by:
readln in interface Console

readCommand

public String[] readCommand()
Description copied from interface: Console
Reads and parses the command line.

Specified by:
readCommand in interface Console
Returns:
The next command or null

getCommandParser

public CommandParser getCommandParser()
Specified by:
getCommandParser in interface Console

setCommandParser

public void setCommandParser(CommandParser parser)
Specified by:
setCommandParser in interface Console

displayList

public void displayList(boolean hasTitle,
                        String... list)
Description copied from interface: Console
Prints the list of String nicely. +-------------+ | Heading | +-------------+ | Item 1 | | Item 2 | | Item 3 | +-------------+

Specified by:
displayList in interface Console
Parameters:
hasTitle - should list[0] be used as a heading
list - The list of Strings to display

printMap

public void printMap(String title,
                     List<List> entries)
Prints the list of String nicely. +----------------------------+ | Heading | +----------------------------+ | title | title | .. +----------------------------+ | Item 2 | value 2 | .. | Item 3 | value 2 | .. +----------------------------+

Specified by:
printMap in interface Console
Parameters:
title - The title to display if any
entries - the entries to display in a map.

close

public void close()
Specified by:
close in interface Console


Licensed to the Apache Software Foundation