Merge pull request #35 from mebigfatguy/develop

make sure magic bytes are read fully
This commit is contained in:
Taro L. Saito 2013-05-14 02:40:38 -07:00
commit 8fce6db8af

View File

@ -91,7 +91,7 @@ public class SnappyCodec
public static SnappyCodec readHeader(InputStream in) throws IOException { public static SnappyCodec readHeader(InputStream in) throws IOException {
DataInputStream d = new DataInputStream(in); DataInputStream d = new DataInputStream(in);
byte[] magic = new byte[MAGIC_LEN]; byte[] magic = new byte[MAGIC_LEN];
d.read(magic, 0, MAGIC_LEN); d.readFully(magic, 0, MAGIC_LEN);
int version = d.readInt(); int version = d.readInt();
int compatibleVersion = d.readInt(); int compatibleVersion = d.readInt();
return new SnappyCodec(magic, version, compatibleVersion); return new SnappyCodec(magic, version, compatibleVersion);