示例#1
0
        void JBasicPermission::init(JString name){
            jint len = name.length();
            if (len == 0) {
                throw new JIllegalArgumentException("name can't be empty");
            }
            jchar last = (jchar)name.charAt(len - 1);

            if (last == '*' && (len == 1 || name.charAt(len - 2) == '.')) {
                wildcard = true;
                if (len == 1) {
                    path = "";
                } else {
                    path = name.substring(0, len - 1);
                }
            } else {
                if (name=="exitVM") {
                    wildcard = true;
                    path = "exitVM.";
                    exitVM = true;
                } else {
                    path = name;
                }
            }
        }
示例#2
0
 void  JWriter::write(JString str,jint off,jint len){
     lock->lock();
     jchar* cbuf;
     if (len <= 1024) {
        cbuf = writeBuffer;
     } else {
        cbuf = new jchar[len];
     }
     for (jint i=0;i<len;i++){
         cbuf[i]=(jchar)str.charAt(off+i);
     }
     write(cbuf, 0, len);
     if (len>1024) {
         delete[] cbuf;
     }
     lock->unlock();
 }
示例#3
0
 JObjectStreamField::JObjectStreamField(JString name,JString signature,jbool unshared):JObject(getClazz()){
     this->name=new JString(name);
     this->signature=new JString(signature);
     this->unshared=unshared;
     this->field=NULL;
     switch(signature.charAt(0)){
         case 'Z':
             type = JPrimitiveBoolean::getClazz();
             break;
         case 'B':
             type = JPrimitiveByte::getClazz();
             break;
         case 'C':
             type = JPrimitiveChar::getClazz();
             break;
         case 'S':
             type = JPrimitiveShort::getClazz();
             break;
         case 'I':
             type = JPrimitiveInt::getClazz();
             break;
         case 'J':
             type = JPrimitiveLong::getClazz();
             break;
         case 'F':
             type = JPrimitiveFloat::getClazz();
             break;
         case 'D':
             type = JPrimitiveDouble::getClazz();
             break;
         case 'L':
         case '[':
             type = JObject::getClazz();
             break;
         default:
             throw new JIllegalArgumentException("illegal signature");
     }
     setTypeString();
 }