public JavaArray(char[] _arr) : base(Java.GetEnvironment(), JavaClass.charclass, 0) { id = env.NewCharArray(_arr.Length); if (id <= 0) { throw new Exception("fail to create an array of char"); } env.SetCharArrayRegion(id, 0, _arr.Length, _arr); }
public JavaArray(short[] _arr) : base(Java.GetEnvironment(), JavaClass.shortclass, 0) { id = env.NewShortArray(_arr.Length); if (id <= 0) { throw new Exception("fail to create an array of short"); } env.SetShortArrayRegion(id, 0, _arr.Length, _arr); }
public JavaArray(byte[] _arr) : base(Java.GetEnvironment(), JavaClass.byteclass, 0) { id = env.NewByteArray(_arr.Length); if (id <= 0) { throw new Exception("fail to create an array of byte"); } env.SetByteArrayRegion(id, 0, _arr.Length, _arr); }
public JavaArray(long[] _arr) : base(Java.GetEnvironment(), JavaClass.longclass, 0) { id = env.NewLongArray(_arr.Length); if (id <= 0) { throw new Exception("fail to create an array of long"); } env.SetLongArrayRegion(id, 0, _arr.Length, _arr); }
public JavaArray(double[] _arr) : base(Java.GetEnvironment(), JavaClass.intclass, 0) { id = env.NewDoubleArray(_arr.Length); if (id <= 0) { throw new Exception("fail to create an array of double"); } env.SetDoubleArrayRegion(id, 0, _arr.Length, _arr); }
public JavaArray(JavaClass _cls, JavaConstructor _constructor, JavaObject[] _arr) : base(Java.GetEnvironment(), _cls, 0) { id = env.NewObjectArray(_arr.Length, _cls.GetID(), _constructor.GetID()); if (id <= 0) { throw new Exception("fail to create an array of object[" + klass.GetClassFullName() + "]"); } for (int i = 0; i < _arr.Length; i++) { env.SetObjectArrayElement(id, i, _arr[i].GetID()); } }
public JavaArray(string[] _arr) : base(Java.GetEnvironment(), null, 0) { klass = new JavaClass(env, "java.lang.String"); JavaConstructor constructor = klass.GetConstructor(); id = env.NewObjectArray(_arr.Length, klass.GetID(), constructor.GetID()); if (id <= 0) { throw new Exception("fail to create an array of object[" + klass.GetClassFullName() + "]"); } for (int i = 0; i < _arr.Length; i++) { int strtmpid = env.NewStringUTF(_arr[i]); env.SetObjectArrayElement(id, i, strtmpid); env.DeleteLocalRef(strtmpid); } }
private JavaClass(string _name) { env = Java.GetEnvironment(); name = _name; id = -1; }