copy file with byte java
var source = new File("src/resources/bugs.txt");
var dest = new File("src/resources/bugs2.txt");
Files.copy(source.toPath(), dest.toPath(),
StandardCopyOption.REPLACE_EXISTING);
//Source: http://zetcode.com/java/copyfile/import java.io.FileInputStream;
import java.io.FileOutputStream;
public class Main {
public static void main(String[] args) {
FileInputStream in =null;
FileOutputStream out=null;
try {
in=new FileInputStream(args[0]);
out=new FileOutputStream(args[1]);
int c;
while ((c=in.read())!=-1){
out.write(c);
}
}
catch (Exception e){
System.out.println("Error Copping File");
}
}
}
Also in Java:
- casting java
- integer max value java
- java enum
- java stream sort
- counting the sequence of character in string java
- java long to int
- how to make a dictionary in java
- byte java
- abs in java
- padding a string with 0 in java
- java for in loop
- java define a generic class that produces
- instantiate optinal java 8
- two dimensional array in java example program
- append to arraylist by index java
- java treemap sort by value in reverse
- inheritance setter and getter in java
- find the day of the week Calendar class in java
- java read from connection even if 404
- how to create a linked list in java
- binary to int java
- convert string to localdatetime
- islowercase java
- java nested loop