Class TextIOUtils
- java.lang.Object
-
- de.julielab.jcore.pipeline.builder.cli.util.TextIOUtils
-
public class TextIOUtils extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTextIOUtils.EmptyStringParser<T>A textIO parser to use withTextIO.newGenericInputReader(Function).
-
Constructor Summary
Constructors Constructor Description TextIOUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PrintElementcreatePrintElement(String text, String prefix)static List<PrintElement>createPrintElements(String... input)Converts an array of text and prefix strings intoPrintElementobjects.static PrintLinecreatePrintLine(String... input)Converts an array of text and prefix strings intoPrintElementobjects and does the exact same thing ascreatePrintElements(String...)except it returns the result as aPrintLine.static voidprintElements(Stream<PrintElement> printElements, org.beryx.textio.TextIO textIO)Prints the passed elements according to their respective prefix.static voidprintLine(PrintLine record, org.beryx.textio.TextIO textIO)static voidprintLines(Stream<PrintLine> records, org.beryx.textio.TextIO textIO)
-
-
-
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 intoPrintElementobjects. Note that the returned list is actually of typePrintLineand 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 intoPrintElementobjects and does the exact same thing ascreatePrintElements(String...)except it returns the result as aPrintLine. 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.
-
createPrintElement
public static PrintElement createPrintElement(String text, String prefix)
-
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.
-
-