make sure magic bytes are read fully

code uses

byte[] magic = new byte[MAGIC_LEN];
d.read(magic, 0, MAGIC_LEN);

changed to 

byte[] magic = new byte[MAGIC_LEN];
d.readFully(magic, 0, MAGIC_LEN);

as the first doesn't necessarily read MAGIC_LEN bytes.