@@ -0,0 +1,1032 @@
+package org.realityforge.antix;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.io.RandomAccessFile;%0Aimport org.apache.tools.ant.BuildException;%0Aimport org.apache.tools.ant.Task;%0A%0A/**%0A * If the file is greater than the specified number of bytes then truncate.%0A */%0Apublic class TruncateTask extends Task%0A%7B%0A  private File file;%0A  private int size;%0A%0A  public void setFile( final File file )%0A  %7B%0A    this.file = file;%0A  %7D%0A%0A  public void setSize( final int size )%0A  %7B%0A    this.size = size;%0A  %7D%0A%0A  public void execute() throws BuildException%0A  %7B%0A    if( null == file ) throw new BuildException( %22file not set.%22 );%0A    if( 0 %3E= size ) throw new BuildException( %22size not set to a value greater than 0.%22 );%0A    if( file.length() %3C size )%0A    %7B%0A      return;%0A    %7D%0A    try%0A    %7B%0A      final RandomAccessFile random = new RandomAccessFile( file, %22rw%22 );%0A      random.setLength( size );%0A      random.close();%0A    %7D%0A    catch( IOException e )%0A    %7B%0A      throw new BuildException( %22Error truncating file %22 + file, e );%0A    %7D%0A  %7D%0A%7D

Add a task to truncate files if they exceed a specified size