text: public static byte[] Encode(string str){ByteBuffer bb = NGit.Constants.CHARSET.Encode(str);int len = bb.Limit();if (bb.HasArray() && bb.ArrayOffset() == 0){byte[] arr = ((byte[])bb.Array());if (arr.Length == len){return arr;}}byte[] arr_1 = new byte[len];bb.Get(arr_1);return arr_1;}