1. 程式人生 > >java jdk動態代理詳解

java jdk動態代理詳解


        }  
    }  

    methods.add(generateStaticInitializer());  
}  
catch(IOException ioexception)  
{  
    throw new InternalError("unexpected I/O Exception");  
}  
if(methods.size() > 65535)  
    throw new IllegalArgumentException("method limit exceeded");  
if(fields.size() > 65535)  
    throw new IllegalArgumentException("field limit exceeded");  
cp.getClass(dotToSlash(className));  
cp.getClass("java/lang/reflect/Proxy");  
for(int j = 0; j < interfaces.length; j++)  
    cp.getClass(dotToSlash(interfaces[j].getName()));  

cp.setReadOnly();  
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();  
DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);  
try  
{  
    dataoutputstream.writeInt(-889275714);  
    dataoutputstream.writeShort(0);  
    dataoutputstream.writeShort(49);  
    cp.write(dataoutputstream);  
    dataoutputstream.writeShort(49);  
    dataoutputstream.writeShort(cp.getClass(dotToSlash(className)));  
    dataoutputstream.writeShort(cp.getClass("java/lang/reflect/Proxy"));  
    dataoutputstream.writeShort(interfaces.length);  
    for(int l = 0; l < interfaces.length; l++)  
        dataoutputstream.writeShort(cp.getClass(dotToSlash(interfaces[l].getName())));  

    dataoutputstream.writeShort(fields.size());  
    FieldInfo fieldinfo;