import java.io.BufferedOutputStream; import java.io.BufferedInputStream; import java.io.DataOutputStream; import java.io.DataInputStream; import java.io.FileOutputStream; import java.io.FileInputStream; class Program01 { public static void main(String[] argv) throws Exception { FileOutputStream fileOut = new FileOutputStream("data.txt"); BufferedOutputStream bufferOut = new BufferedOutputStream(fileOut); DataOutputStream dataOut = new DataOutputStream(bufferOut); dataOut.writeUTF("árvíztűrő"); dataOut.writeLong(34L); dataOut.writeInt(44); dataOut.writeDouble(32.343); dataOut.writeBoolean(true); dataOut.close(); bufferOut.close(); fileOut.close(); FileInputStream fileIn = new FileInputStream("data.txt"); BufferedInputStream bufferIn = new BufferedInputStream(fileIn); DataInputStream dataIn = new DataInputStream(bufferIn); System.out.println(dataIn.readUTF()); System.out.println(dataIn.readLong()); System.out.println(dataIn.readInt()); System.out.println(dataIn.readDouble()); System.out.println(dataIn.readBoolean()); dataIn.close(); bufferIn.close(); fileIn.close(); } }