//*****************************************************************************
// Read file and copy into another using Java "nio" package
// Entire file is read into a string and then written to another file                           
//*****************************************************************************
import java.nio.file.*;                             //import nio.file package

public class copyFile0  
{ 
      public static void main(String[ ] args) throws Exception		        //since I am not using try/catch block
      {
            Path infile  = Path.of("/home/sultans/web/java/demo/8inpout/data/temp.txt");
            Path outfile = Path.of("/home/sultans/web/java/demo/8inpout/data/temp2.txt");

            String str     = Files.readString(infile);			            //read entire file into a single string

            Files.writeString(outfile, str, StandardOpenOption.APPEND); 	//write string into a file, w/ append
      }
}