public static byte[] ReadBytes(Stream stream) { //VarInt length uint length = ReadUInt32 (stream); //Bytes byte[] buffer = new byte[length]; if(length != 0) stream.Read (buffer, 0, buffer.Length); return buffer; }