Top Description Fields Constructors Methods
org.codehaus.commons.compiler.io

public final Class Readers

extends Object
Class Inheritance
Imports
java.io.FilterReader, .IOException, .Reader, .StringReader, .StringWriter, .Writer, java.util.Arrays, .Iterator, org.codehaus.commons.compiler.util.LineAndColumnTracker, org.codehaus.commons.nullanalysis.NotNullByDefault, .Nullable

Utiltity methods related to Reader.

Field Summary

Modifier and TypeField and Description
public static final Reader
EMPTY_READER

Any attempts to read return an "end-of-input" condition.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Reader
concat(Reader... delegates)

public static Reader

Returns:

Reads from the first element of the delegates, then, after EOI, from the second until EOI, and so forth
concat
(final Iterable<Reader> delegates)

public static void
copy(Reader in, Writer out)

public static Reader

Returns:

FilterReader that runs the runnable right before the first character is read
onFirstChar
(Reader in, final Runnable runnable)

public static String
public static Reader

Returns:

A Reader that copies the bytes being passed through to a given Writer; this is in analogy with the UNIX "tee" command
teeReader
(Reader in, final Writer out, final boolean closeWriterOnEoi)

public static Reader

Returns:

A FilterReader that tracks line and column numbers while characters are being read
trackLineAndColumn
(Reader in, final LineAndColumnTracker tracker)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_READERback to summary
public static final Reader EMPTY_READER

Any attempts to read return an "end-of-input" condition.

Constructor Detail

Readersback to summary
private Readers()

Method Detail

concatback to summary
public static Reader concat(Reader... delegates)
concatback to summary
public static Reader concat(final Iterable<Reader> delegates)
Returns:Reader

Reads from the first element of the delegates, then, after EOI, from the second until EOI, and so forth

copyback to summary
public static void copy(Reader in, Writer out) throws IOException
onFirstCharback to summary
public static Reader onFirstChar(Reader in, final Runnable runnable)
Returns:Reader

FilterReader that runs the runnable right before the first character is read

readAllback to summary
public static String readAll(Reader in) throws IOException
teeReaderback to summary
public static Reader teeReader(Reader in, final Writer out, final boolean closeWriterOnEoi)
Returns:Reader

A Reader that copies the bytes being passed through to a given Writer; this is in analogy with the UNIX "tee" command

trackLineAndColumnback to summary
public static Reader trackLineAndColumn(Reader in, final LineAndColumnTracker tracker)
Returns:Reader

A FilterReader that tracks line and column numbers while characters are being read