(Access is denied) error
I am trying to copy selected few files from source to destination.
public class filesMove
{
public filesMove()
{
}
void copyDirectory(File source, File destination) throws IOException
{
System.out.println("source: "+source);
//output: source: D:\fonts\xyz.PFB
//output: source: D:\fonts\xyz.PFM
System.out.println("destination:"+destination);
//output: destination: C:\temp\Installation
copyFile(source, destination);
}
private void copyFile(File src, File dst) throws IOException
{
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while((len = in.read(buf)) > 0)
{
out.write(buf, 0, len);
}
in.close();
out.close();
}
}

