易截截图软件、单文件、免安装、纯绿色、仅160KB

Java Dynamic Proxy

import java.lang.reflect.*;
public class A extends Thread  {
    
    public static void main(String[] args) throws Exception{
    CC cc = new CC();
    HH hh = new HH(cc);
    II ii = (II) Proxy.newProxyInstance(HH.class.getClassLoader(),
                        new Class[]{II.class},
                        hh);
    System.out.println ("" + ii.getClass().getName());
    ii.test();
    }
}
interface II {
    void test();
}
class CC implements II {
    public void test() {
    System.out.println ("this is cc");
    }
}
class HH implements InvocationHandler {
    Object obj;
    HH(Object obj) {
    this.obj = obj;
    }
    
    public Object invoke(Object obj, Method m, Object[] args) throws Exception {
    System.out.println ("start");
    Object o = m.invoke(this.obj, args);
    System.out.println ("end");
    return o;
    }
}
运行时加入 -Dsun.misc.ProxyGenerator.saveGeneratedFiles=true,可以得到proxy class。
参考:http://www.javablogging.com/what-is-java-dynamic-proxies-api/
 


相关文档:

Java 调用 Oracle 存储过程返回结果集

Oracle 存储过程返回结果集用 ref cursor 实现。
试验步骤如下:
1. 建立 ref cursor 类型和过程
CREATE OR REPLACE PACKAGE types
AS
    TYPE ref_cursor IS REF CURSOR;
END;
/
CREATE TABLE STOCK_PRICES(
    RIC VARCHAR(6) PRIMARY KEY,
    PRICE NUMBER(7 ......

略论基于JAVA/JSP的网上书店系统

【摘要
JAVA语言是目前Internet上大型的WEB应用程序开发时使用得最热门的编程语言,本文描述了JAVA和JSP技术的特征以及在互联网上的使用情况,介绍这两种技术的重要编程方法和两者之关的联系,并完成一个基于这种技术的网上书店系统。
【关键字JAVA, JavaBeans, Servlet, JSP, 网络编程, 电子商务, 网上书店
Abstract
A ......

java第5天的代码

/*****************Animal.java begin ***********************/
 public class Animal{
 
 public void jj(){
  
 }
 
 public static void main(String args[]){
  //编译时类型       //运行时类型
  Animal anima ......

JAVA NIO 中文1

 
If the requested address is not a valid virtual memory address (it doesn't belong to any of
the memory segments of the executing process), the page cannot be validated, and
a segmentation fault is generated. This vectors control to another part of the kernel and
usually results in the pro ......

java 与 c# 3des 加解密

 
java 与 c# 3des 加解密 
主要差异如下:
1、 对于待加密解密的数据,各自的填充模式不一样
C#的模式有:ANSIX923、ISO10126、None、PKCS7、Zero,而Java有:NoPadding、PKCS5Padding、SSL3Padding
2、 各自默认的3DES实现,模式和填充方式不一样
C#的默认模式为CBC,默认填充方式为PKCS7; java的默认模式 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号