FileDocCategorySizeDatePackage
FileCopyExample.javaAPI DocExample1705Wed May 18 09:39:00 BST 2005com.discursive.jccook.io

FileCopyExample

public class FileCopyExample extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		try {
			File src = new File( "test.dat" );
			File dest = new File( "test.dat.bak" );
			
			FileUtils.copyFile( src, dest );
		} catch( IOException ioe ) {
			System.out.println( "Problem copying file." );
		}
		
		try {
			File src = new File( "test.dat" );
			File dir = new File( "./temp" );

			FileUtils.copyFileToDirectory( src, dir );
		} catch( IOException ioe ) {
			System.out.println( "Problem copying file to dir.");
		}
		
		try {
			String string = "Blah blah blah";
			File dest = new File( "test.tmp" );
			
			FileUtils.writeStringToFile( dest, string, "ISO-8859-1" );
		} catch( IOException ioe ) {
			System.out.println( "Error writing out a String." );			
		}