git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270807 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -19,6 +19,7 @@ import java.util.ArrayList; | |||||
| import java.util.Stack; | import java.util.Stack; | ||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.avalon.excalibur.io.IOUtil; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.types.FilterSetCollection; | import org.apache.tools.ant.types.FilterSetCollection; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -102,24 +103,16 @@ public class FileUtils | |||||
| line = in.readLine(); | line = in.readLine(); | ||||
| } | } | ||||
| out.close(); | |||||
| in.close(); | |||||
| IOUtil.shutdownReader( in ); | |||||
| IOUtil.shutdownWriter( out ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| FileInputStream in = new FileInputStream( sourceFile ); | |||||
| FileOutputStream out = new FileOutputStream( destFile ); | |||||
| byte[] buffer = new byte[ 8 * 1024 ]; | |||||
| int count = 0; | |||||
| do | |||||
| { | |||||
| out.write( buffer, 0, count ); | |||||
| count = in.read( buffer, 0, buffer.length ); | |||||
| } while( count != -1 ); | |||||
| in.close(); | |||||
| out.close(); | |||||
| final FileInputStream in = new FileInputStream( sourceFile ); | |||||
| final FileOutputStream out = new FileOutputStream( destFile ); | |||||
| IOUtil.copy( in, out ); | |||||
| IOUtil.shutdownStream( in ); | |||||
| IOUtil.shutdownStream( out ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -19,6 +19,7 @@ import java.util.ArrayList; | |||||
| import java.util.Stack; | import java.util.Stack; | ||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.avalon.excalibur.io.IOUtil; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.types.FilterSetCollection; | import org.apache.tools.ant.types.FilterSetCollection; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -102,24 +103,16 @@ public class FileUtils | |||||
| line = in.readLine(); | line = in.readLine(); | ||||
| } | } | ||||
| out.close(); | |||||
| in.close(); | |||||
| IOUtil.shutdownReader( in ); | |||||
| IOUtil.shutdownWriter( out ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| FileInputStream in = new FileInputStream( sourceFile ); | |||||
| FileOutputStream out = new FileOutputStream( destFile ); | |||||
| byte[] buffer = new byte[ 8 * 1024 ]; | |||||
| int count = 0; | |||||
| do | |||||
| { | |||||
| out.write( buffer, 0, count ); | |||||
| count = in.read( buffer, 0, buffer.length ); | |||||
| } while( count != -1 ); | |||||
| in.close(); | |||||
| out.close(); | |||||
| final FileInputStream in = new FileInputStream( sourceFile ); | |||||
| final FileOutputStream out = new FileOutputStream( destFile ); | |||||
| IOUtil.copy( in, out ); | |||||
| IOUtil.shutdownStream( in ); | |||||
| IOUtil.shutdownStream( out ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||