List of usage examples for java.io FileOutputStream FileOutputStream
public FileOutputStream(FileDescriptor fdObj)
From source file:Main.java
public static void main(String[] args) throws Exception { FileOutputStream fos = new FileOutputStream("C:/WriteFloat.txt"); DataOutputStream dos = new DataOutputStream(fos); float f = 5.314f; dos.writeFloat(f);/* ww w . j a v a 2 s. com*/ dos.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { FileOutputStream fos = new FileOutputStream("C:/Int.txt"); DataOutputStream dos = new DataOutputStream(fos); int i = 100;/*from w w w .ja va2 s .c o m*/ dos.writeInt(i); dos.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { FileOutputStream fos = new FileOutputStream("C:/WriteBoolean.txt"); DataOutputStream dos = new DataOutputStream(fos); boolean b = false; dos.writeBoolean(b);/*from w w w .java 2 s . com*/ dos.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { FileOutputStream fos = new FileOutputStream("C:/Bytes.txt"); DataOutputStream dos = new DataOutputStream(fos); dos.writeBytes("this is a test"); int bytesWritten = dos.size(); System.out.println("Total " + bytesWritten + " bytes are written to stream."); dos.close();// w ww. ja v a 2 s. c o m }
From source file:Main.java
public static void main(String[] args) throws Exception { FileReader fileReader = new FileReader(new FileOutputStream("c:/abc.txt").getFD()); System.out.println(fileReader.read()); fileReader.close();//from w ww . j a v a 2 s.c om }
From source file:Main.java
public static void main(String[] args) throws Exception { FileOutputStream fos = new FileOutputStream("C:/Demo.txt"); BufferedOutputStream bos = new BufferedOutputStream(fos); byte b = 66;// w w w . j a v a 2 s . co m // write a character represented by ascii 66 i.e. 'B' bos.write(b); bos.flush(); bos.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { FileWriter fileWriter = new FileWriter(new FileOutputStream("c:/abc.txt").getFD()); fileWriter.append("java2s.com"); fileWriter.close();/* w ww . ja va2 s .c o m*/ }
From source file:Main.java
public static void main(String[] args) throws IOException { FileOutputStream fos = new FileOutputStream("C://text.txt"); fos.close();/*www.j a va 2 s .com*/ // try to write into underlying stream fos.write(65); fos.flush(); fos.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { String strFilePath = "C://demo.txt"; FileOutputStream fos = new FileOutputStream(strFilePath); String strContent = "Write File using Java FileOutputStream example !"; fos.write(strContent.getBytes());//from www.jav a2 s . c o m fos.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { FileOutputStream fos = new FileOutputStream("C:/WriteLong.txt"); DataOutputStream dos = new DataOutputStream(fos); long l = 65;/*from w w w. j av a 2 s .com*/ dos.writeLong(l); for (int i = 0; i < 10; i++) dos.writeInt(i); dos.close(); }