Esempio n. 1
0
        byte[] toByteArray(VectorChar v)
        {
            byte[] bytes = new byte[v.Count];
            int    i     = 0;

            foreach (char c in v)
            {
                bytes[i++] = (byte)c;
            }
            return(bytes);
        }
Esempio n. 2
0
        string toString(VectorChar v)
        {
            char[] cc = new char[v.Count];
            int    i  = 0;

            foreach (char c in v)
            {
                cc.SetValue((char)(c & 0x00ff), i++);
            }
            return(new string(cc));
        }
Esempio n. 3
0
        VectorChar toVectorChar(byte[] s)
        {
            if (s == null)
            {
                return(null);
            }
            VectorChar v = new VectorChar();

            foreach (char c in s)
            {
                v.Add(c);
            }
            return(v);
        }
Esempio n. 4
0
        private Object unwrap(VectorChar input)
        {
            if (input == null)
            {
                return(null);
            }
            byte[] barray = new byte[input.Count];
            int    i      = 0;

            foreach (char c in input)
            {
                barray[i++] = (byte)c;
            }
            return(marshaller.ObjectFromByteBuffer(barray));
        }
Esempio n. 5
0
        public object Execute(string scriptName, IDictionary <string, Object> dict = null)
        {
            VectorMap vm = new VectorMap();

            if (dict != null)
            {
                foreach (KeyValuePair <string, Object> p in dict)
                {
                    VectorChar vcKey   = toVectorChar(p.Key);
                    VectorChar vcValue = toVectorChar(argMarshaller.ObjectToByteBuffer(p.Value));
                    vm.Add(vcKey, vcValue);
                }
            }
            VectorByte vb = cache.execute(scriptName, vm);

            byte[] ret = new byte[vb.Count];
            vb.CopyTo(ret);
            return(argMarshaller.ObjectFromByteBuffer(ret));
        }