lol i know that, but what the command in java to copy a file?
Printable View
lol i know that, but what the command in java to copy a file?
There is no command for copying files, you need to create a new empty file local, and copy from that file on netwotk into new file created...
but how do you copy the contents of an excel file???
An example should be:
import java.io.*;
public class Copy {
public static void main(String[] args) throws IOException {
FileReader in = new FileReader("in.txt");
FileWriter out = new FileWriter("out.txt");
int c;
while ((c = in.read()) != -1)
out.write(c);
in.close();
out.close();
}
}
which copy character with caracter (it works!)
Or :
BufferedWriter out = new BufferedWriter(
new FileWriter("out.dat"), 1024)
for(int i=0; i<1024; i++)
out.write(i);
out.flush();
for writing to a file and using BufferedReade(new FileReader(...)) for reading from a file