⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 repositoryid.java

📁 java1.6众多例子参考
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	    if (repId.startsWith(kIDLPrefix)) {		typeString =		    repId.substring(kIDLPrefixLength, repId.indexOf(':', kIDLPrefixLength));		isIDLType = true;		if (typeString.startsWith(kIDLNamePrefix))		    completeClassName = kIDLClassnamePrefix + 			typeString.substring(kIDLNamePrefix.length()).replace('/','.');		else 		    completeClassName = typeString.replace('/','.');	    } else if (repId.startsWith(kValuePrefix)) {		typeString =		    repId.substring(kValuePrefixLength, repId.indexOf(':', kValuePrefixLength));		isRMIValueType = true;		if (versionString.indexOf('.') == -1) {		    actualSuid = versionString.substring(1);		    suid = actualSuid;  // default if not explicitly specified						    if (actualSuid.indexOf(':') != -1){		    // we have a declared hash also			int pos = actualSuid.indexOf(':')+1;			// actualSuid = suid.substring(pos);			// suid = suid.substring(0, pos-1);			suid = actualSuid.substring(pos);			actualSuid = actualSuid.substring(0, pos-1);		    }		} else {		    // _REVISIT_ : Special case version failure ?		}	    } else {		isSupportedFormat = false;		typeString = "" ;	    }	    if (typeString.startsWith(kSequencePrefix)) {		isSequence = true;	    }			    return this;	}    }    public final String getUnqualifiedName() {	if (unqualifiedName == null){	    String className = getClassName();	    int index = className.lastIndexOf('.');	    if (index == -1){		unqualifiedName = className;		definedInId = "IDL::1.0";	    }	    else {		unqualifiedName = className.substring(index);		definedInId = "IDL:" + className.substring(0, index).replace('.','/') + ":1.0";	    }	}			return unqualifiedName;    }    public final String getDefinedInId() {	if (definedInId == null){	    getUnqualifiedName();	}			return definedInId;    }    public final String getTypeString() {        return typeString;    }    public final String getVersionString() {        return versionString;    }	    public final String getSerialVersionUID() {	return suid;    }    public final String getActualSerialVersionUID() {	return actualSuid;    }    public final long getSerialVersionUIDAsLong() {	return suidLong;    }    public final long getActualSerialVersionUIDAsLong() {	return actualSuidLong;    }    public final boolean isRMIValueType() {	return isRMIValueType;    }	    public final boolean isIDLType() {	return isIDLType;    }    public final String getRepositoryId() {        return repId;    }    public static byte[] getByteArray(String repStr) {	synchronized (repStrToByteArray){	    return (byte[]) repStrToByteArray.get(repStr);	}    }    public static void setByteArray(String repStr, byte[] repStrBytes) {	synchronized (repStrToByteArray){	    repStrToByteArray.put(repStr, repStrBytes);	}    }    public final boolean isSequence() {        return isSequence;    }    public final boolean isSupportedFormat() {        return isSupportedFormat;    }	    // This method will return the classname from the typestring OR if the classname turns out to be    // a special class "pseudo" name, then the matching real classname is returned.    public final String getClassName() {	if (isRMIValueType)	    return typeString;	else if (isIDLType)	    return completeClassName;	else return null;    }    // This method calls getClazzFromType() and falls back to the repStrToClass    // cache if no class was found.  It's used where any class matching the    // given repid is an acceptable result.    public final Class getAnyClassFromType() throws ClassNotFoundException {        try {	    return getClassFromType();	} catch (ClassNotFoundException cnfe) {	    Class clz = (Class)repStrToClass.get(repId);	    if (clz != null)		return clz;	    else		throw cnfe;	}    }    public final Class getClassFromType()        throws ClassNotFoundException {	if (clazz != null)	    return clazz;			Class specialCase = (Class)kSpecialCasesClasses.get(getClassName());	if (specialCase != null){	    clazz = specialCase;	    return specialCase;	}	else	    {		try{		    return Util.loadClass(getClassName(), null, null);		}		catch(ClassNotFoundException cnfe){		    if (defaultServerURL != null) {			try{			    return getClassFromType(defaultServerURL);			}			catch(MalformedURLException mue){			    throw cnfe;			}		    }		    else throw cnfe;		}	    }    }    public final Class getClassFromType(Class expectedType, String codebase)        throws ClassNotFoundException {	if (clazz != null)	    return clazz;			Class specialCase = (Class)kSpecialCasesClasses.get(getClassName());	if (specialCase != null){	    clazz = specialCase;	    return specialCase;	} else {            ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader());            return Utility.loadClassOfType(getClassName(),                                            codebase,                                            expectedTypeClassLoader,                                            expectedType,                                            expectedTypeClassLoader);        }    }    public final Class getClassFromType(String url) 	throws ClassNotFoundException, MalformedURLException {	return Util.loadClass(getClassName(), url, null);    }    public final String toString() {    	return repId;    }    /**     * Checks to see if the FullValueDescription should be retrieved.     * @exception Throws IOException if suids do not match or if the repositoryID     * is not an RMIValueType     */    public static boolean useFullValueDescription(Class clazz, String repositoryID)	throws IOException{	String clazzRepIDStr = createForAnyType(clazz);	if (clazzRepIDStr.equals(repositoryID))	    return false;	RepositoryId targetRepid;	RepositoryId clazzRepid;	synchronized(cache) {	// to avoid race condition where multiple threads could be	// accessing this method, and their access to the cache may	// be interleaved giving unexpected results	    targetRepid = cache.getId(repositoryID);	    clazzRepid = cache.getId(clazzRepIDStr);	}	//ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);			if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())){	    if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) {		String mssg = "Mismatched serialization UIDs : Source (Rep. ID" + 		    clazzRepid + ") = " + 		    clazzRepid.getSerialVersionUID() + " whereas Target (Rep. ID " + repositoryID + 		    ") = " + targetRepid.getSerialVersionUID();				//com.sun.corba.se.impl.io.ValueUtility.log("RepositoryId",mssg);		throw new IOException(mssg);	}	    else {		return true;	    }			}	else {	    throw new IOException("The repository ID is not of an RMI value type (Expected ID = " + clazzRepIDStr + "; Received ID = " + repositoryID +")");    }    }    private static String createHashString(java.io.Serializable ser) {	return createHashString(ser.getClass());    }    private static String createHashString(java.lang.Class clazz) {	if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz))	    return kInterfaceHashCode;	//ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);	long actualLong = ObjectStreamClass.getActualSerialVersionUID(clazz);	String hash = null;	if (actualLong == 0)	    hash = kInterfaceOnlyHashStr;	else if (actualLong == 1)	    hash = kExternalizableHashStr;	else	    hash = Long.toHexString(actualLong).toUpperCase();	while(hash.length() < 16){	    hash = "0" + hash;	}	long declaredLong = ObjectStreamClass.getSerialVersionUID(clazz);	String declared = null;	if (declaredLong == 0)	    declared = kInterfaceOnlyHashStr;	else if (declaredLong == 1)	    declared = kExternalizableHashStr;	else	    declared = Long.toHexString(declaredLong).toUpperCase();	while (declared.length() < 16){	    declared = "0" + declared;    }	hash = hash + ":" + declared;	return ":" + hash;    }    /**     * Creates a repository ID for a sequence.  This is for expert users only as     * this method assumes the object passed is an array.  If passed an object      * that is not an array, it will produce a rep id for a sequence of zero      * length.  This would be an error.     * @param ser The Java object to create a repository ID for     **/    public static String createSequenceRepID(java.lang.Object ser){	return createSequenceRepID(ser.getClass());    }    /**     * Creates a repository ID for a sequence.  This is for expert users only as     * this method assumes the object passed is an array.  If passed an object      * that is not an array, it will produce a malformed rep id.     * @param clazz The Java class to create a repository ID for     **/    public static String createSequenceRepID(java.lang.Class clazz){	synchronized (classSeqToRepStr){		        String repid = (String)classSeqToRepStr.get(clazz);	if (repid != null)	    return repid;	Class originalClazz = clazz;        Class type = null;	int numOfDims = 0;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -