Scan

Description

Scan is used to scan files. It is basically the same than the concat ant task with the following modifications:

Definition

Using taskdef:
<taskdef name="scan"
         classname="net.sf.antcount.tasks.Scan"
         classpath="antcount.jar" />

Attributes

Name Description Required Default
encoding Specifies the encoding for the input files. Please see http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html for a list of possible values. Defaults to the platform's default character encoding. No System encoding
fixlastline Specifies whether or not to check if each file concatenated is terminated by a new line. If this attribute is "true" a new line will be appended to the stream if the file did not end in a new line. No False
eol Specifies what the end of line character are for use by the fixlastline attribute. Valid values for this property are:
  • cr: a single CR
  • lf: a single LF
  • crlf: the pair CRLF
  • mac: a single CR
  • unix: a single LF
  • dos: the pair CRLF
No Platform dependent. For Unix platforms, the default is "lf". For DOS based systems (including Windows), the default is "crlf". For Mac OS, the default is "cr".

Nested Elements

Scan accepts the following nested elements.

fileset

Files to be scanned. See the fileset documentation in the ant manual.

zipdata

This element represents zipped data to be read. These data are zip entries in one or several zip files. Zip files are selected using nested filesets and zip entries are selected using nested patternsets.
For example, the following will select all files named myfolder/access* in zip files named log*.zip:
You can use the attribute verbose="true" to print out which zip file and zip entry is currently being read.
<zipdata>
	<fileset dir="." includes="log*.zip" />
	<patternset>
		<include name="myfolder/access*" />
	</patternset>
</zipdata>

filterchain

Filters to apply. See the filterchain documentation in the ant manual.

Examples

Scan ${log.dir}/**/*.log and all access* in zip files ${log.dir}/**/log*.zip and count lines:

<scan>
	<fileset dir="${log.dir}" includes="**/*.log" />
	<zipdata>
		<fileset dir="${log.dir}" includes="**/log*.zip" />
		<patternset>
			<include name="access*" />
		</patternset>
	</zipdata>
	<filterchain>
		<countfilter property="nb.lines" />
	</filterchain>
</scan>