DataOutputStream: writeLong(long l) : DataOutputStream « java.io « Java by API






DataOutputStream: writeLong(long l)

/*
 * 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.new DataOutputStream(FileOutputStream fileOutputStream)
2.DataOutputStream: writeBoolean(boolean b)
3.DataOutputStream: writeByte(byte b)
4.DataOutputStream: writeChar(char ch)
5.DataOutputStream: writeDouble(double d)
6.DataOutputStream: writeFloat(float f)
7.DataOutputStream: writeInt(int i)
8.DataOutputStream: writeShort(int i)
9.DataOutputStream: writeUTF(String str)