Use readVLong and writeVLong from ByteArrayDataInput/Output instead of from BytesRef.