import java.io.DataOutputStream;
import java.io.FileOutputStream;
class DataOutputStreamDemo {
public static void main(String args[]) throws Exception {
FileOutputStream fos = new FileOutputStream(args[0]);
DataOutputStream dos = new DataOutputStream(fos);
// Write various types of data
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();
}
}
|