FileDocCategorySizeDatePackage
CopyChannels.javaAPI DocExample543Sat Apr 23 22:35:36 BST 2005None

CopyChannels

public class CopyChannels extends Object

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

		String fromFileName = args[0];
		String toFileName = args[1];
		FileChannel in = new FileInputStream( fromFileName ).getChannel();
		FileChannel out = new FileOutputStream( toFileName ).getChannel();
		
		ByteBuffer buff = ByteBuffer.allocate( 32*1024 );

		while ( in.read( buff ) > 0 ) {
			buff.flip();
			out.write( buff );
			buff.clear();
		}

		in.close();
		out.close();