src/com/esotericsoftware/scar/Scar.java
static public String copyFile (String in, String out) throws IOException {
		if (in == null) throw new IllegalArgumentException("in cannot be null.");
		if (out == null) throw new IllegalArgumentException("out cannot be null.");

		if (TRACE) trace("scar", "Copying file: " + in + " -> " + out);

		FileChannel sourceChannel = null;
		FileChannel destinationChannel = null;
		try {
			sourceChannel = new FileInputStream(in).getChannel();
			destinationChannel = new FileOutputStream(out).getChannel();
			sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
		} catch (IOException ex) {
			throw new IOException("Error copying: " + in + "\nTo: " + out, ex);
		} finally {
			try {
				if (sourceChannel != null) sourceChannel.close();
			} catch (Exception ignored) {
			}
			try {
				if (destinationChannel != null) destinationChannel.close();
			} catch (Exception ignored) {
			}
		}
		return out;
	}
/** Copies a file, overwriting any existing file at the destination. */
Copies a file, overwriting any existing file at the destination.
Copies a file overwriting any existing file at the destination .
static public String copyFile (String in, String out) throws IOException {
		if (in == null) throw new IllegalArgumentException("in cannot be null.");
		if (out == null) throw new IllegalArgumentException("out cannot be null.");
		if (TRACE) trace("scar", "Copying file: " + in + " -> " + out);
		FileChannel sourceChannel = null;
		FileChannel destinationChannel = null;
		try {
			sourceChannel = new FileInputStream(in).getChannel();
			destinationChannel = new FileOutputStream(out).getChannel();
			sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
		} catch (IOException ex) {
			throw new IOException("Error copying: " + in + "\nTo: " + out, ex);
		} finally {
			try {
				if (sourceChannel != null) sourceChannel.close();
			} catch (Exception ignored) {
			}
			try {
				if (destinationChannel != null) destinationChannel.close();
			} catch (Exception ignored) {
			}
		}
		return out;
	}
static public String copyFile ( String in , String out ) throws IOException { if ( in == null ) throw new IllegalArgumentException ( "in cannot be null." ) ; if ( out == null ) throw new IllegalArgumentException ( "out cannot be null." ) ; if ( TRACE ) trace ( "scar" , "Copying file: " + in + " -> " + out ) ; FileChannel sourceChannel = null ; FileChannel destinationChannel = null ; try { sourceChannel = new FileInputStream ( in ) . getChannel ( ) ; destinationChannel = new FileOutputStream ( out ) . getChannel ( ) ; sourceChannel . transferTo ( 0 , sourceChannel . size ( ) , destinationChannel ) ; } catch ( IOException ex ) { throw new IOException ( "Error copying: " + in + "\nTo: " + out , ex ) ; } finally { try { if ( sourceChannel != null ) sourceChannel . close ( ) ; } catch ( Exception ignored ) { } try { if ( destinationChannel != null ) destinationChannel . close ( ) ; } catch ( Exception ignored ) { } } return out ; }
Copies a file, overwriting any existing file at the destination.
Copies a file overwriting any existing file at the destination .