package day22;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class Dk4Data {
public static void main(String[] args) throws IOException {
DataOutputStream dos = new DataOutputStream(new FileOutputStream("b.txt"));
dos.writeInt(997);
dos.writeInt(998);
dos.writeInt(999);
dos.close();
DataInputStream dis = new DataInputStream(new FileInputStream("b.txt"));
int b;
while((b=dis.readInt())!=-1) {
System.out.println(b);
}
dis.close();
}
public static void pre() throws FileNotFoundException, IOException {
FileOutputStream fos = new FileOutputStream("a.txt");
fos.write(997);
fos.write(998);
fos.write(999);
fos.close();
FileInputStream fis = new FileInputStream("a.txt");
int b;
while((b=fis.read())!=-1) {
System.out.println(b);
}
fis.close();
}
}