you should use the ```readFully```[2] because the ```read```[1] does not ensure that you read all ```length``` bytes.

[1] http://docs.oracle.com/javase/7/docs/api/java/io/ObjectInput.html#read(byte[], int, int)
[2] http://docs.oracle.com/javase/7/docs/api/java/io/DataInput.html#readFully(byte[], int, int)