예제 #1
0
        private static void PutVarInt(int input, MemoryStream byteArrayDataOutput)
        {
            var output = new byte[VarInt.VarIntSize(input)];

            VarInt.PutVarInt(input, output, 0);
            byteArrayDataOutput.Write(output, 0, output.Length);
        }
예제 #2
0
        private static void EncodeString(String input, MemoryStream output)
        {
            int length = input.Length;

            byte[] bytes = new byte[VarInt.VarIntSize(length)];
            VarInt.PutVarInt(length, bytes, 0);
            output.Write(bytes, 0, bytes.Length);
            byte[] inPutBytes = Encoding.UTF8.GetBytes(input);
            output.Write(inPutBytes, 0, inPutBytes.Length);
        }