Class ManReaderExt
- java.lang.Object
-
- manifold.io.extensions.java.io.Reader.ManReaderExt
-
public class ManReaderExt extends Object
-
-
Constructor Summary
Constructors Constructor Description ManReaderExt()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BufferedReaderbuffered(Reader thiz)Returns a buffered reader wrapping this Reader, or this Reader itself if it is already buffered.static BufferedReaderbuffered(Reader thiz, int bufferSize)static voidforEachLine(Reader thiz, Consumer<String> action)Iterates through each line of this reader, callsactionfor each line read and closes theReaderwhen it's completed.static List<String>readLines(Reader thiz)Reads this reader content as a list of lines.static <T> TuseLines(Reader thiz, Function<Iterable<String>,T> block)Calls theblockcallback giving it a sequence of all the lines in this file and closes the reader once the processing is complete.
-
-
-
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.
-
buffered
public static BufferedReader buffered(Reader thiz, int bufferSize)
-
forEachLine
public static void forEachLine(Reader thiz, Consumer<String> action)
Iterates through each line of this reader, callsactionfor each line read and closes theReaderwhen 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.
-
-