Advertisement
jaVer404

add_content_funct

Nov 7th, 2015
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. /**
  2. *add content of one file to another
  3. *
  4. */    
  5. public static void fileCopy (String writeTo, String writeFrom) throws IOException {
  6.         FileInputStream fileInputStream = new FileInputStream(writeFrom);
  7.         FileOutputStream fileOutputStream = new FileOutputStream(writeTo,true);
  8.         byte[]buffer = new byte[(int)new File(writeFrom).length()];
  9.         while (fileInputStream.available()>0) {
  10.             int count = fileInputStream.read(buffer);
  11.             fileOutputStream.write(buffer,0,count);
  12.         }
  13.         fileInputStream.close();
  14.         fileOutputStream.close();
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement