ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Checksum.java
Date Tue, 11 Jun 2002 14:14:49 GMT
bodewig     2002/06/11 07:14:48

  Modified:    .        Tag: ANT_15_BRANCH WHATSNEW
               docs/manual/CoreTasks Tag: ANT_15_BRANCH checksum.html
               src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
                        Checksum.java
  Log:
  Add a buffer to <checksum>
  
  PR: 9704
  Submitted by:	gjfdh@yahoo.com
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.263.2.32 +5 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.263.2.31
  retrieving revision 1.263.2.32
  diff -u -r1.263.2.31 -r1.263.2.32
  --- WHATSNEW	11 Jun 2002 08:14:15 -0000	1.263.2.31
  +++ WHATSNEW	11 Jun 2002 14:14:48 -0000	1.263.2.32
  @@ -20,6 +20,11 @@
   * Nested <property>'s inside <ant> can now be overriden by subsequent
     <ant> and <antcall> tasks.
   
  +Other changes:
  +--------------
  +
  +* <checksum> now uses a buffer (of configurable size).
  +
   Changes from Ant 1.5beta1 to Ant 1.5beta2
   =========================================
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +7 -0      jakarta-ant/docs/manual/CoreTasks/checksum.html
  
  Index: checksum.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/checksum.html,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- checksum.html	3 Feb 2002 22:00:41 -0000	1.4
  +++ checksum.html	11 Jun 2002 14:14:48 -0000	1.4.2.1
  @@ -73,6 +73,13 @@
       check against the generated checksum.
       <td valign="top" align="center">No</td>
     </tr>
  +  <tr>
  +    <td valign="top">readbuffersize</td>
  +    <td valign="top">The size of the buffer )in bytes) to use when
  +    reading a file. Defaults to &quot;8192&quot; - you may get a
  +    better performance on big files if you increase this value.</td>
  +    <td valign="top" align="center">No</td>
  +  </tr>
   </table>
   <h3>Parameters specified as nested elements</h3>
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.22.2.1  +14 -2     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java
  
  Index: Checksum.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java,v
  retrieving revision 1.22
  retrieving revision 1.22.2.1
  diff -u -r1.22 -r1.22.2.1
  --- Checksum.java	15 Apr 2002 15:33:08 -0000	1.22
  +++ Checksum.java	11 Jun 2002 14:14:48 -0000	1.22.2.1
  @@ -129,6 +129,10 @@
        * is this task being used as a nested condition element?
        */
       private boolean isCondition;
  +    /**
  +     * Size of the read buffer to use.
  +     */
  +    private int readBufferSize = 8 * 1024;
   
       /**
        * Sets the file for which the checksum is to be calculated.
  @@ -186,6 +190,13 @@
       }
   
       /**
  +     * The size of the read buffer to use.
  +     */
  +    public void setReadBufferSize(int size) {
  +        this.readBufferSize = size;
  +    }
  +
  +    /**
        * Adds a set of files (nested fileset attribute).
        */
       public void addFileset(FileSet set) {
  @@ -356,6 +367,7 @@
           boolean checksumMatches = true;
           FileInputStream fis = null;
           FileOutputStream fos = null;
  +        byte[] buf = new byte[readBufferSize];
           try {
               for (Enumeration e = includeFileMap.keys(); e.hasMoreElements();) {
                   messageDigest.reset();
  @@ -366,8 +378,8 @@
                   fis = new FileInputStream(src);
                   DigestInputStream dis = new DigestInputStream(fis,
                                                                 messageDigest);
  -                while (dis.read() != -1) {
  -                 ;
  +                while (dis.read(buf, 0, readBufferSize) != -1) {
  +                    ;
                   }
                   dis.close();
                   fis.close();
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message