How to copy files over Network to LocalDrive in Java -
i need sample code copies files on network local file system in java. how done in java?
here code copies files in local file system
file fromfile = new file("file"); file tofile = new file("../copiedfile"); tofile.createnewfile(); fileinputstream = new fileinputstream(fromfile); fileoutputstream = new fileoutputstream(tofile); byte [] buffer = new byte[4096]; int bytesread; while ((bytesread = from.read(buffer)) != -1) { to.write(buffer, 0, bytesread); }
i think, if want copy files on network should send buffer using objectoutput
, sockets
Comments
Post a Comment