Class AlignedBlock


  • public class AlignedBlock
    extends Object
    A block of tabulated text. Rows can be added with the align() method, each string representing the text for an aligned column. The print method outputs the block, optionally outputting a separator.
    Author:
    Bruce Skingle
    • Constructor Detail

      • AlignedBlock

        public AlignedBlock​(IndentedPrintStream out)
        Constructor.
        Parameters:
        out - An IndentedPrintStream to which the block will be output.
    • Method Detail

      • align

        public void align​(Object... o)
        Add a row to the block, each String represents a piece of text which should be aligned.
        Parameters:
        o - Variable number of Strings to align.
      • print

        public void print​(String separator,
                          String terminator)
        Outputs the block, with the given separator appended to each line except the last, and the given terminator appended to the last line.
        Parameters:
        separator - text added to each line except the last/
        terminator - text added to the last line.
      • print

        public void print()
        Output the block without additional separators.