String readStr() { VarInt varInt = new VarInt(bytes, cursor); if (varInt.value == 0) { cursor += 1; return ""; } cursor += varInt.getSizeInBytes(); byte[] characters = new byte[(int)varInt.value]; bytes.CopyTo(cursor, characters, 0, characters.Length); cursor += characters.Length; return Encoding.UTF8.GetString(characters); }
long readVarInt(int offset) { VarInt varint = new VarInt(bytes, cursor + offset); cursor += offset + varint.getSizeInBytes(); return varint.value; }