-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathByteStream01.java
More file actions
64 lines (54 loc) · 1.8 KB
/
Copy pathByteStream01.java
File metadata and controls
64 lines (54 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package bytestream01;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.Serializable;
import java.util.Scanner;
import org.omg.CORBA.Any;
import org.omg.CORBA.Object;
import org.omg.CORBA.TypeCode;
/**
*
* @author the_developer
*/
public class ByteStream01 {
/**
* @param args the command line arguments
*/
static String Eno,E_name,Dept,dob,doj;
static String Employee_datail;
static int salary;
public static void main(String[] args) throws Exception{
Scanner s = new Scanner(System.in);
System.out.println("Enter Employee Details");
Eno = s.nextLine();
E_name = s.nextLine();
Dept = s.nextLine();
dob = s.nextLine();
doj = s.nextLine();
salary = s.nextInt();
Employee_datail = Eno+" \n"+E_name+" \n"+Dept+" \n"+dob+" \n"+doj+" \n"+salary+" \n";
write();
read();
}
private static void write() throws Exception{
File file = new File(Eno+".txt");
FileOutputStream fos = new FileOutputStream(file);
DataOutputStream dos = new DataOutputStream(fos);
dos.writeUTF(Employee_datail);
}
private static void read() throws Exception {
File file = new File(Eno+".txt");
FileInputStream fis = new FileInputStream(file);
DataInputStream dis = new DataInputStream(fis);
String detail = dis.readUTF();
System.out.println(detail);
}
}