=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java 2010-05-06 11:38:23 +0000 @@ -75,6 +75,27 @@ return classLoader.getResourceAsStream( name ); } + public static void streamcopy(BufferedInputStream in, BufferedOutputStream out) + { + int b = 0; + + try + { + while ( ( b = in.read() ) != -1 ) + { + out.write( b ); + } + } + catch ( IOException ex ) + { + throw new RuntimeException( ex ); + } + finally + { + closeInputStream( in ); + closeOutputStream( out ); + } + } /** * Writes the content of the first File to the second File. * @@ -85,18 +106,12 @@ { BufferedInputStream in = null; BufferedOutputStream out = null; - - int b = 0; - - try - { + + try { in = new BufferedInputStream( new FileInputStream( inFile ) ); out = new BufferedOutputStream( new FileOutputStream( outFile ) ); - - while ( ( b = in.read() ) != -1 ) - { - out.write( b ); - } + + streamcopy(in, out); } catch ( IOException ex ) { @@ -106,8 +121,8 @@ { closeInputStream( in ); closeOutputStream( out ); - } + } /**