Append output to file using FileOutputStream : FileOutputStream « File Input Output « Java






Append output to file using FileOutputStream

   


import java.io.FileOutputStream;

public class Main {
  public static void main(String[] args) throws Exception {
    FileOutputStream fos = new FileOutputStream("C:/demo.txt", true);
    fos.write("Appended".getBytes());
    fos.close();
  }
}

   
    
    
  








Related examples in the same category

1.File IO
2.Copy Bytes between FileInputStream and FileOutputStream
3.Copy byte between FileInputStream and FileOutputStream
4.Write byte array to a file using FileOutputStream
5.Create DataOutputStream from FileOutputStream
6.Write double to a file using DataOutputStream
7.Create FileOutputStream object from File object
8.Create FileOutputStream object from String file path
9.Write file using FileOutputStream
10.Use FileOutputStream to write the bytes to a file.
11.Write UTF String, integer and double with DataOutputStream
12.Write data with FileOutputStream
13.Split file
14.Rollover FileOutputStream