byte[] toByteArray(VectorChar v) { byte[] bytes = new byte[v.Count]; int i = 0; foreach (char c in v) { bytes[i++] = (byte)c; } return(bytes); }
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)); }
VectorChar toVectorChar(byte[] s) { if (s == null) { return(null); } VectorChar v = new VectorChar(); foreach (char c in s) { v.Add(c); } return(v); }
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)); }
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)); }