import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class InputOutputDemoBinaryFile {
public static void main(String[] a) throws Exception {
//Write primitive values to a binary file "rntsoft.dat":
DataOutputStream dos = new DataOutputStream(new FileOutputStream(
"rntsoft.dat"));
dos.writeInt(228);
dos.writeChar(' ');
dos.writeUTF("Java Source and Support at www.rntsoft.com");
dos.close();
//Read primitive values from binary file "rntsoft.dat":
DataInputStream dis = new DataInputStream(new FileInputStream(
"rntsoft.dat"));
System.out.println(dis.readInt() + "|" + dis.readChar() + "|"
+ dis.readUTF());
}
}