<replacetoken> element.
| Modifier and Type | Class and Description |
|---|---|
| private class | Replace.
Class reading a file in small chunks, and presenting these chunks in a StringBuffer. |
| private class | Replace.
Component writing a file in chunks, taking the chunks from the Replacefilter. |
| public class | Replace.
An inline string to use as the replacement text. |
| public class | Replace.
A filter to apply. |
| Modifier and Type | Field and Description |
|---|---|
| private File | |
| private String | encoding
The encoding used to read and write files - if null, uses default |
| private boolean | |
| private static final FileUtils | |
| private int | |
| private boolean | |
| private Properties | |
| private Resource | |
| private int | |
| private Resource | |
| private List | |
| private Union | |
| private File | |
| private boolean | |
| private Replace. | |
| private Replace. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addConfigured(ResourceCollection
ResourceCollection rc)Support arbitrary file system based resource collections. |
| private StringBuffer | Returns: StringBuffer containing the output of the last filter.StringBuffer containing the input for the
first filter.Creates the chain of filters to operate. |
| private Replace. | Returns: a nestedReplacefilter object to be configured.Adds the token and value as first <replacefilter> element. |
| public Replace. | Returns: a nestedReplacefilter object to be configured.Add a nested <replacefilter> element. |
| public Replace. | Returns: nested tokenNestedString to configure.Create a token to filter as the text of a nested element. |
| public Replace. | Returns: replacement valueNestedString to configure.Create a string to replace the token as the text of a nested element. |
| public void | |
| private void | |
| private Iterator | getOrderedIterator(Properties
Properties props)Sort keys by size so that tokens that are substrings of other strings are tried later. |
| public Properties | Returns: loadedProperties object.the file to load the properties from. propertyFile)Load a properties file. |
| public Properties | Returns: loadedProperties object.the resource to load the properties from. propertyResource)Load a properties resource. |
| private void | |
| private void | |
| private boolean | Returns: true if the filter chain produced new output.Performs the normal processing of the filters. |
| public void | |
| public void | setEncoding(String
the encoding to use on the files. encoding)Set the file encoding to use on the files read and written by the task; optional, defaults to default JVM encoding. |
| public void | setFailOnNoReplacements(boolean
boolean b)Whether the build should fail if nothing has been replaced. |
| public void | |
| public void | setPreserveLastModified(boolean
boolean b)Whether the file timestamp shall be preserved even if the file is modified. |
| public void | setPropertyFile(File
File to load.The name of a property file from which properties specified using nested
|
| public void | setPropertyResource(Resource
Resource to load.A resource from which properties specified using nested
|
| public void | setReplaceFilterFile(File
File to load.Sets the name of a property file containing filters; optional. |
| public void | setReplaceFilterResource(Resource
Resource to load.Sets the name of a resource containing filters; optional. |
| public void | setSummary(boolean
boolean whether a summary of the
replace operation should be logged.Indicates whether a summary of the replace operation should be
produced, detailing how many token occurrences and files were
processed; optional, default= |
| public void | |
| public void | |
| private void | stringReplace(StringBuilder
StringBuilder str, String String str1, String String str2)Replace occurrences of str1 in StringBuffer str with str2. |
| public void | |
| public void |
| dir | back to summary |
|---|---|
| private File dir | |
| encoding | back to summary |
|---|---|
| private String encoding The encoding used to read and write files - if null, uses default | |
| failOnNoReplacements | back to summary |
|---|---|
| private boolean failOnNoReplacements | |
| FILE_UTILS | back to summary |
|---|---|
| private static final FileUtils FILE_UTILS | |
| fileCount | back to summary |
|---|---|
| private int fileCount | |
| preserveLastModified | back to summary |
|---|---|
| private boolean preserveLastModified | |
| properties | back to summary |
|---|---|
| private Properties properties | |
| propertyResource | back to summary |
|---|---|
| private Resource propertyResource | |
| replaceCount | back to summary |
|---|---|
| private int replaceCount | |
| replaceFilterResource | back to summary |
|---|---|
| private Resource replaceFilterResource | |
| replacefilters | back to summary |
|---|---|
| private List<Replace. | |
| resources | back to summary |
|---|---|
| private Union resources | |
| sourceFile | back to summary |
|---|---|
| private File sourceFile | |
| summary | back to summary |
|---|---|
| private boolean summary | |
| token | back to summary |
|---|---|
| private Replace. | |
| value | back to summary |
|---|---|
| private Replace. | |
| Replace | back to summary |
|---|---|
| public Replace() | |
| addConfigured | back to summary |
|---|---|
| public void addConfigured(ResourceCollection rc) Support arbitrary file system based resource collections.
| |
| buildFilterChain | back to summary |
|---|---|
| private StringBuffer buildFilterChain(StringBuffer inputBuffer) Creates the chain of filters to operate.
| |
| createPrimaryfilter | back to summary |
|---|---|
| private Replace. Adds the token and value as first <replacefilter> element. The token and value are always processed first.
| |
| createReplacefilter | back to summary |
|---|---|
| public Replace. Add a nested <replacefilter> element.
| |
| createReplaceToken | back to summary |
|---|---|
| public Replace. Create a token to filter as the text of a nested element.
| |
| createReplaceValue | back to summary |
|---|---|
| public Replace. Create a string to replace the token as the text of a nested element.
| |
| execute | back to summary |
|---|---|
| public void execute() throws BuildException Overrides org. Do the execution.
| |
| flushFilterChain | back to summary |
|---|---|
| private void flushFilterChain() Flushes all filters. | |
| getOrderedIterator | back to summary |
|---|---|
| private Iterator Sort keys by size so that tokens that are substrings of other strings are tried later.
| |
| getProperties | back to summary |
|---|---|
| public Properties getProperties(File propertyFile) throws BuildException Load a properties file.
| |
| getProperties | back to summary |
|---|---|
| public Properties getProperties(Resource propertyResource) throws BuildException Load a properties resource.
| |
| logFilterChain | back to summary |
|---|---|
| private void logFilterChain(String filename) Logs the chain of filters to operate on the file.
| |
| processFile | back to summary |
|---|---|
| private void processFile(File src) throws BuildException Perform the replacement on the given file. The replacement is performed on a temporary file which then replaces the original file.
| |
| processFilterChain | back to summary |
|---|---|
| private boolean processFilterChain() Performs the normal processing of the filters.
| |
| setDir | back to summary |
|---|---|
| public void setDir(File dir) The base directory to use when replacing a token in multiple files;
required if
| |
| setEncoding | back to summary |
|---|---|
| public void setEncoding(String encoding) Set the file encoding to use on the files read and written by the task; optional, defaults to default JVM encoding.
| |
| setFailOnNoReplacements | back to summary |
|---|---|
| public void setFailOnNoReplacements(boolean b) Whether the build should fail if nothing has been replaced.
| |
| setFile | back to summary |
|---|---|
| public void setFile(File file) Set the source file; required unless
| |
| setPreserveLastModified | back to summary |
|---|---|
| public void setPreserveLastModified(boolean b) Whether the file timestamp shall be preserved even if the file is modified.
| |
| setPropertyFile | back to summary |
|---|---|
| public void setPropertyFile(File propertyFile) The name of a property file from which properties specified using nested
| |
| setPropertyResource | back to summary |
|---|---|
| public void setPropertyResource(Resource propertyResource) A resource from which properties specified using nested
| |
| setReplaceFilterFile | back to summary |
|---|---|
| public void setReplaceFilterFile(File replaceFilterFile) Sets the name of a property file containing filters; optional. Each property will be treated as a replacefilter where token is the name of the property and value is the value of the property.
| |
| setReplaceFilterResource | back to summary |
|---|---|
| public void setReplaceFilterResource(Resource replaceFilter) Sets the name of a resource containing filters; optional. Each property will be treated as a replacefilter where token is the name of the property and value is the value of the property.
| |
| setSummary | back to summary |
|---|---|
| public void setSummary(boolean summary) Indicates whether a summary of the replace operation should be
produced, detailing how many token occurrences and files were
processed; optional, default=
| |
| setToken | back to summary |
|---|---|
| public void setToken(String token) Set the string token to replace; required unless a nested
| |
| setValue | back to summary |
|---|---|
| public void setValue(String value) Set the string value to use as token replacement; optional, default is the empty string "".
| |
| stringReplace | back to summary |
|---|---|
| private void stringReplace(StringBuilder str, String str1, String str2) Replace occurrences of str1 in StringBuffer str with str2.
| |
| validateAttributes | back to summary |
|---|---|
| public void validateAttributes() throws BuildException Validate attributes provided for this task in .xml build file.
| |
| validateReplacefilters | back to summary |
|---|---|
| public void validateReplacefilters() throws BuildException Validate nested elements.
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private char[] | |
| private final InputStream | |
| private StringBuffer | |
| private Reader |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv StringBuffer | Returns: The StringBuffer containing the output of this filter.Retrieves the output buffer of this filter. |
| pack-priv boolean | Returns: true when the end of the file has not been reached.Reads some data from the file. |
| BUFF_SIZE | back to summary |
|---|---|
| private static final int BUFF_SIZE | |
| buffer | back to summary |
|---|---|
| private char[] buffer | |
| is | back to summary |
|---|---|
| private final InputStream is | |
| outputBuffer | back to summary |
|---|---|
| private StringBuffer outputBuffer | |
| reader | back to summary |
|---|---|
| private Reader reader | |
| FileInput | back to summary |
|---|---|
| pack-priv FileInput(File source) throws IOException Constructs the input component. Opens the file for reading.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Closes the file.
| |
| getOutputBuffer | back to summary |
|---|---|
| pack-priv StringBuffer getOutputBuffer() Retrieves the output buffer of this filter. The component guarantees that data is only appended to the end of this StringBuffer.
| |
| readChunk | back to summary |
|---|---|
| pack-priv boolean readChunk() throws IOException Reads some data from the file.
| |
| Modifier and Type | Field and Description |
|---|---|
| private StringBuffer | |
| private final OutputStream | |
| private Writer |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv void | |
| pack-priv boolean | Returns: false to be inline with the Replacefilter. (Yes defining an interface crossed my mind, but would publish the internal behavior.)Writes the buffer as far as possible. |
| pack-priv void | setInputBuffer(StringBuffer
The input for this filter. input)Sets the input buffer for this component. |
| inputBuffer | back to summary |
|---|---|
| private StringBuffer inputBuffer | |
| os | back to summary |
|---|---|
| private final OutputStream os | |
| writer | back to summary |
|---|---|
| private Writer writer | |
| FileOutput | back to summary |
|---|---|
| pack-priv FileOutput(File out) throws IOException Constructs the output component. Opens the file for writing.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Closes the file.
| |
| flush | back to summary |
|---|---|
| pack-priv void flush() throws IOException Processes the buffer to the end.
| |
| process | back to summary |
|---|---|
| pack-priv boolean process() throws IOException Writes the buffer as far as possible.
| |
| setInputBuffer | back to summary |
|---|---|
| pack-priv void setInputBuffer(StringBuffer input) Sets the input buffer for this component. The filter expects from the component providing the input that data is only added by that component to the end of this StringBuffer. This StringBuffer will be modified by this filter, and expects that another component will only append to this StringBuffer.
| |
| Modifier and Type | Field and Description |
|---|---|
| private StringBuffer | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public String | |
| public void |
| buf | back to summary |
|---|---|
| private StringBuffer buf | |
| expandProperties | back to summary |
|---|---|
| private boolean expandProperties | |
| NestedString | back to summary |
|---|---|
| public NestedString() | |
| addText | back to summary |
|---|---|
| public void addText(String val) The text of the element.
| |
| getText | back to summary |
|---|---|
public String getText()
| |
| setExpandProperties | back to summary |
|---|---|
| public void setExpandProperties(boolean b) Whether properties should be expanded in nested test. If you use this class via its Java interface the text
you add via
| |
| Modifier and Type | Field and Description |
|---|---|
| private StringBuffer | |
| private StringBuffer | |
| private String | |
| private String | |
| private Replace. | |
| private Replace. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Replace. | Returns: nested tokenNestedString to configure.Create a token to filter as the text of a nested element. |
| public Replace. | Returns: replacement valueNestedString to configure.Create a string to replace the token as the text of a nested element. |
| pack-priv void | |
| pack-priv StringBuffer | Returns: The StringBuffer containing the output of this filter.Retrieves the output buffer of this filter. |
| public String | Returns: property or null.Get the name of the property whose value is to serve as the replacement value. |
| public String | |
| public String | |
| public String | |
| pack-priv boolean | Returns: true if some data has been made available in the output buffer.Processes the buffer as far as possible. |
| private int | Returns: The position of the last character that was inserted as replacement.Performs the replace operation. |
| pack-priv void | |
| public void | setProperty(String
property name. property)Set the name of the property whose value is to serve as
the replacement value; required if |
| public void | |
| public void | |
| public void |
| inputBuffer | back to summary |
|---|---|
| private StringBuffer inputBuffer | |
| outputBuffer | back to summary |
|---|---|
| private StringBuffer outputBuffer | |
| property | back to summary |
|---|---|
| private String property | |
| replaceValue | back to summary |
|---|---|
| private String replaceValue | |
| token | back to summary |
|---|---|
| private Replace. | |
| value | back to summary |
|---|---|
| private Replace. | |
| Replacefilter | back to summary |
|---|---|
| public Replacefilter() | |
| createReplaceToken | back to summary |
|---|---|
| public Replace. Create a token to filter as the text of a nested element.
| |
| createReplaceValue | back to summary |
|---|---|
| public Replace. Create a string to replace the token as the text of a nested element.
| |
| flush | back to summary |
|---|---|
| pack-priv void flush() Processes the buffer to the end. Does not take into account that appended data may make it possible to replace the end of the already received data. | |
| getOutputBuffer | back to summary |
|---|---|
| pack-priv StringBuffer getOutputBuffer() Retrieves the output buffer of this filter. The filter guarantees that data is only appended to the end of this StringBuffer.
| |
| getProperty | back to summary |
|---|---|
| public String getProperty() Get the name of the property whose value is to serve as the replacement value.
| |
| getReplaceValue | back to summary |
|---|---|
| public String getReplaceValue() Get the replacement value for this filter token.
| |
| getToken | back to summary |
|---|---|
| public String getToken() Get the string to search for.
| |
| getValue | back to summary |
|---|---|
| public String getValue() Get replacement
| |
| process | back to summary |
|---|---|
| pack-priv boolean process() Processes the buffer as far as possible. Takes into account that appended data may make it possible to replace the end of the already received data, when the token is split over the "old" and the "new" part.
| |
| replace | back to summary |
|---|---|
| private int replace() Performs the replace operation.
| |
| setInputBuffer | back to summary |
|---|---|
| pack-priv void setInputBuffer(StringBuffer input) Sets the input buffer for this filter. The filter expects from the component providing the input that data is only added by that component to the end of this StringBuffer. This StringBuffer will be modified by this filter, and expects that another component will only append to this StringBuffer.
| |
| setProperty | back to summary |
|---|---|
| public void setProperty(String property) Set the name of the property whose value is to serve as
the replacement value; required if
| |
| setToken | back to summary |
|---|---|
| public void setToken(String t) Set the token to replace.
| |
| setValue | back to summary |
|---|---|
| public void setValue(String value) The replacement string; required if
| |
| validate | back to summary |
|---|---|
| public void validate() throws BuildException Validate the filter's configuration.
| |