Hope this little example helps you :)
import java.io.*;
class copy {
public static void main (String args[]) throws IOException {
if (args.length != 2)
throw (new RuntimeException ("Syntax: copy <src> <dest>"));
FileInputStream in = new FileInputStream(args[0]);
FileOutputStream out = new FileOutputStream(args[1]);
byte buffer[] = new byte[16];
int n;
while ((n = in.read (buffer)) > -1)
out.write(buffer, 0, n);
out.close();
in.close();
System.out.println("END");
}
}
===================================================================
Javier Gil Candelas Dpto. Ingenieria de Sistemas Telematicos
email: [EMAIL PROTECTED] E.T.S.I. Telecomunicacion - UPM
http://isengard.dit.upm.es Ciudad Universitaria
Tfno:(+34) 913367366 ext:809 E-28040 Madrid, SPAIN
===================================================================
On Thu, 17 Dec 1998, Sze Yuen Wong wrote:
> Hi,
>
> Anybody know how to copy a file in Java?
>
> Thanks.
>
> Sze Yuen
>
>
>
> _________________________________________________________
> DO YOU YAHOO!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>