Class TextIOUtils


  • public class TextIOUtils
    extends Object
    • Constructor Detail

      • TextIOUtils

        public TextIOUtils()
    • Method Detail

      • printLine

        public static void printLine​(PrintLine record,
                                     org.beryx.textio.TextIO textIO)
      • printLines

        public static void printLines​(Stream<PrintLine> records,
                                      org.beryx.textio.TextIO textIO)
      • createPrintElements

        public static List<PrintElement> createPrintElements​(String... input)
        Converts an array of text and prefix strings into PrintElement objects. Note that the returned list is actually of type PrintLine and thus can safely be casted to this type if required.
        Parameters:
        input - An array of text and TextIO prefix identifiers, always as pairs in this order.
        Returns:
        The converted print element list.
      • createPrintLine

        public static PrintLine createPrintLine​(String... input)
        Converts an array of text and prefix strings into PrintElement objects and does the exact same thing as createPrintElements(String...) except it returns the result as a PrintLine. This is only for convenience to distinguish between arbitrary lists of print elements (PrintElement) and lists that should represent a line of output (PrintLine).
        Parameters:
        input - An array of text and TextIO prefix identifiers, always as pairs in this order.
        Returns:
        The converted print element list.
      • printElements

        public static void printElements​(Stream<PrintElement> printElements,
                                         org.beryx.textio.TextIO textIO)
        Prints the passed elements according to their respective prefix.
        Parameters:
        printElements - The elements to print.
        textIO - The textIO instance of output.