How in java file open and write this data to another file?
|
1 answer
If you use only standard tools, then in a simplified form like this:
FileInputStream fis = new FileInputStream(new File("/path/to/file")); FileOutputStream fos = new FileOutputStram(new File("/path/to/destination/file")); byte[] buffer = new byte[512]; int rc; while((rc = fis.read(buffer)) != -1) { fos.write(buffer, 0, rc); } fos.close(); fis.close(); |