Thursday, April 4, 2019

How to Copy Paste file in java [Java Code]

copy Paste file in java code:

import java.io.*;//Package

class copyfile{

public static void main(String...str) throws IOException

{

int c;

FileInputStream fr=new FileInputStream("demo.pdf");//input file name

BufferedInputStream br=new BufferedInputStream(fr);

FileOutputStream fw=new FileOutputStream("testfile.pdf");//output file name

while((c=br.read())!=-1)

{
fw.write(c);
}
fr.close();
fw.close();
}
}

No comments:

Post a Comment