예제 #1
0
 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);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }
예제 #4
0
 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);
 }
예제 #5
0
 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);
 }
예제 #6
0
 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());
     }
 }
예제 #7
0
        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);
            }
        }
예제 #8
0
 private JavaClass(string _name)
 {
     env = Java.GetEnvironment(); name = _name; id = -1;
 }