Package org.codehaus.commons.compiler.io
Class Readers
- java.lang.Object
-
- org.codehaus.commons.compiler.io.Readers
-
public final class Readers extends java.lang.Object
Utiltity methods related toReader
.
-
-
Field Summary
Fields Modifier and Type Field Description static java.io.Reader
EMPTY_READER
Any attempts to read return an "end-of-input" condition.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.Reader
concat(java.io.Reader... delegates)
static java.io.Reader
concat(java.lang.Iterable<java.io.Reader> delegates)
static void
copy(java.io.Reader in, java.io.Writer out)
static java.io.Reader
onFirstChar(java.io.Reader in, java.lang.Runnable runnable)
static java.lang.String
readAll(java.io.Reader in)
static java.io.Reader
teeReader(java.io.Reader in, java.io.Writer out, boolean closeWriterOnEoi)
static java.io.Reader
trackLineAndColumn(java.io.Reader in, LineAndColumnTracker tracker)
-
-
-
Method Detail
-
onFirstChar
public static java.io.Reader onFirstChar(java.io.Reader in, java.lang.Runnable runnable)
- Returns:
FilterReader
that runs the runnable right before the first character is read
-
trackLineAndColumn
public static java.io.Reader trackLineAndColumn(java.io.Reader in, LineAndColumnTracker tracker)
- Returns:
- A
FilterReader
that tracks line and column numbers while characters are being read
-
concat
public static java.io.Reader concat(java.io.Reader... delegates)
-
concat
public static java.io.Reader concat(java.lang.Iterable<java.io.Reader> delegates)
- Returns:
- Reads from the first element of the delegates, then, after EOI, from the second until EOI, and so forth
-
teeReader
public static java.io.Reader teeReader(java.io.Reader in, java.io.Writer out, boolean closeWriterOnEoi)
- Returns:
- A
Reader
that copies the bytes being passed through to a givenWriter
; this is in analogy with the UNIX "tee" command
-
readAll
public static java.lang.String readAll(java.io.Reader in) throws java.io.IOException
- Throws:
java.io.IOException
-
copy
public static void copy(java.io.Reader in, java.io.Writer out) throws java.io.IOException
- Throws:
java.io.IOException
-
-