| Modifier and Type | Field and Description |
|---|---|
static Reader |
EMPTY_READER
A reader that always signals "end-of-input".
|
| Modifier and Type | Method and Description |
|---|---|
static Reader |
asReader(CharSequence cs)
Wraps the given
CharSequence in a Reader - much more efficient than "new
StringReader(cs.toString)". |
static Reader |
onFirstChar(Reader in,
Runnable runnable) |
static String |
readAll(Reader reader) |
static String |
readAll(Reader reader,
boolean closeReader) |
static int |
readFully(Reader in,
char[] buffer,
int offset,
int len) |
static Reader |
singlingFilterReader(Reader delegate) |
static Reader |
trackLineAndColumn(Reader in,
LineUtil.LineAndColumnTracker tracker) |
static Reader |
wye(Reader in,
Writer out)
Creates and returns a
Reader that duplicates all chars read from in and writes them to
out. |
public static final Reader EMPTY_READER
public static int readFully(Reader in, char[] buffer, int offset, int len) throws IOException
IOExceptionpublic static String readAll(Reader reader) throws IOException
Reader producesIOExceptionpublic static String readAll(Reader reader, boolean closeReader) throws IOException
closeReader - Whether the reader should be closed before the method returnsReader producesIOExceptionpublic static Reader asReader(CharSequence cs)
CharSequence in a Reader - much more efficient than "new
StringReader(cs.toString)".public static Reader singlingFilterReader(Reader delegate)
Reader for which Reader.read(char[], int, int) returns at most 1public static Reader onFirstChar(Reader in, Runnable runnable)
FilterReader that runs the runnable right before the first character is readpublic static Reader trackLineAndColumn(Reader in, LineUtil.LineAndColumnTracker tracker)
FilterReader that tracks line and column numbers while characters are being readLineUtil.lineAndColumnTracker()public static Reader wye(Reader in, Writer out)
Reader that duplicates all chars read from in and writes them to
out.
Out is never flushed automatically; if you want to have that, you must flush out yourself.
Reader.close() closes in but does not flush nor close out.
Copyright © 2022 Arno Unkrig. All rights reserved.