I have written information to a file in python using struct.pack eg.
out.write( struct.pack(">f", 1.1) );
out.write( struct.pack(">i", 12) );
out.write( struct.pack(">3s", "abc") );
Then I read it in java using DataInputStream
and readInt
, readFloat
and readUTF
.
Reading the numbers works but as soon as I call readUTF()
I get EOFException
.
I assume this is because of the differences in the format of the string being written and the way java reads it, or am I doing something wrong?
If they are incompatible, is there another way to read and write strings?