new DataOutputStream(FileOutputStream fileOutputStream) : DataOutputStream « java.io « Java by API






new DataOutputStream(FileOutputStream fileOutputStream)

/*
 * Output:
 */

import java.io.DataOutputStream;
import java.io.FileOutputStream;

public class MainClass {

  public static void main(String args[]) {
    try {

      FileOutputStream fos = new FileOutputStream(args[0]);

      DataOutputStream dos = new DataOutputStream(fos);

      dos.writeBoolean(false);
      dos.writeByte(Byte.MAX_VALUE);
      dos.writeChar('A');
      dos.writeDouble(Double.MAX_VALUE);
      dos.writeFloat(Float.MAX_VALUE);
      dos.writeInt(Integer.MAX_VALUE);
      dos.writeLong(Long.MAX_VALUE);
      dos.writeShort(Short.MAX_VALUE);

      fos.close();
    } catch (Exception e) {
      System.out.println("Exception: " + e);
    }
  }
}       
       








Related examples in the same category

1.DataOutputStream: writeBoolean(boolean b)
2.DataOutputStream: writeByte(byte b)
3.DataOutputStream: writeChar(char ch)
4.DataOutputStream: writeDouble(double d)
5.DataOutputStream: writeFloat(float f)
6.DataOutputStream: writeInt(int i)
7.DataOutputStream: writeLong(long l)
8.DataOutputStream: writeShort(int i)
9.DataOutputStream: writeUTF(String str)