I want to copy a source file in a destination file,knowing that those two files have to be chosen by a choosefiler and past it in a textfield to see the fullpath so how to choose the full path of a file in textfield by choosefiler and put it in this code
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(new File(""));
fos = new FileOutputStream(new File(""));
byte[] buf = new byte[8];
int n = 0;
while ((n = fis.read(buf)) >= 0) {
for (byte bit : buf) {
System.out.print("\t" + bit + "(" + (char) bit + ")");
System.out.println("");
}
buf = new byte[8];
}
System.out.println("Copie terminée !");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fis != null)
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
if (fos != null)
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}