Java examples for File Path IO:File Stream
Flush output stream
import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void main(String[] args) { String strFilePath = "C://Folder//WriteByte.txt"; /*from w w w.ja v a 2 s .c o m*/ try{ FileOutputStream fos = new FileOutputStream(strFilePath); DataOutputStream dos = new DataOutputStream(fos); String strContent = "This example shows how to flush output stream!"; dos.writeBytes(strContent); dos.flush(); dos.close(); }catch (IOException e) { System.out.println("IOException : " + e); } } }