Package org.apache.tools.ant.filters
Class BaseFilterReader
java.lang.Object
java.io.Reader
java.io.FilterReader
org.apache.tools.ant.filters.BaseFilterReader
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Readable
- Direct Known Subclasses:
- BaseParamFilterReader,- ClassConstants,- ExpandProperties,- StripJavaComments,- TokenFilter
Base class for core filter readers.
- 
Field SummaryFields inherited from class java.io.FilterReaderin
- 
Constructor SummaryConstructorsConstructorDescriptionConstructor used by Ant's introspection mechanism.Creates a new filtered reader.
- 
Method SummaryModifier and TypeMethodDescriptionprotected final booleanReturns the initialized status.protected final ProjectReturns the project this filter is part of.final intread(char[] cbuf, int off, int len) Reads characters into a portion of an array.protected final StringReads to the end of the stream, returning the contents as a String.protected final StringreadLine()Reads a line of text ending with '\n' (or until the end of the stream).protected final voidsetInitialized(boolean initialized) Sets the initialized status.final voidsetProject(Project project) Sets the project to work with.final longskip(long n) Skips characters.Methods inherited from class java.io.FilterReaderclose, mark, markSupported, read, ready, resetMethods inherited from class java.io.ReadernullReader, read, read, transferTo
- 
Constructor Details- 
BaseFilterReaderpublic BaseFilterReader()Constructor used by Ant's introspection mechanism. The original filter reader is only used for chaining purposes, never for filtering purposes (and indeed it would be useless for filtering purposes, as it has no real data to filter). ChainedReaderHelper uses this placeholder instance to create a chain of real filters.
- 
BaseFilterReaderCreates a new filtered reader.- Parameters:
- in- A Reader object providing the underlying stream. Must not be- null.
 
 
- 
- 
Method Details- 
readReads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.- Overrides:
- readin class- FilterReader
- Parameters:
- cbuf- Destination buffer to write characters to. Must not be- null.
- off- Offset at which to start storing characters.
- len- Maximum number of characters to read.
- Returns:
- the number of characters read, or -1 if the end of the stream has been reached
- Throws:
- IOException- If an I/O error occurs
 
- 
skipSkips characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.- Overrides:
- skipin class- FilterReader
- Parameters:
- n- The number of characters to skip
- Returns:
- the number of characters actually skipped
- Throws:
- IllegalArgumentException- If- nis negative.
- IOException- If an I/O error occurs
 
- 
setInitializedprotected final void setInitialized(boolean initialized) Sets the initialized status.- Parameters:
- initialized- Whether or not the filter is initialized.
 
- 
getInitializedprotected final boolean getInitialized()Returns the initialized status.- Returns:
- whether or not the filter is initialized
 
- 
setProjectSets the project to work with.- Parameters:
- project- The project this filter is part of. Should not be- null.
 
- 
getProjectReturns the project this filter is part of.- Returns:
- the project this filter is part of
 
- 
readLineReads a line of text ending with '\n' (or until the end of the stream). The returned String retains the '\n'.- Returns:
- the line read, or nullif the end of the stream has already been reached
- Throws:
- IOException- if the underlying reader throws one during reading
 
- 
readFullyReads to the end of the stream, returning the contents as a String.- Returns:
- the remaining contents of the reader, as a String
- Throws:
- IOException- if the underlying reader throws one during reading
 
 
-