Class ManReaderExt


  • public class ManReaderExt
    extends Object
    • Constructor Detail

      • ManReaderExt

        public ManReaderExt()
    • Method Detail

      • buffered

        public static BufferedReader buffered​(Reader thiz)
        Returns a buffered reader wrapping this Reader, or this Reader itself if it is already buffered.
      • forEachLine

        public static void forEachLine​(Reader thiz,
                                       Consumer<String> action)
        Iterates through each line of this reader, calls action for each line read and closes the Reader when it's completed.
        Parameters:
        action - function to process file lines.
      • readLines

        public static List<String> readLines​(Reader thiz)
        Reads this reader content as a list of lines. Do not use this function for huge files.
      • useLines

        public static <T> T useLines​(Reader thiz,
                                     Function<Iterable<String>,​T> block)
        Calls the block callback giving it a sequence of all the lines in this file and closes the reader once the processing is complete.
        Returns:
        the value returned by block.