Here you can find the source of saveProxyClass(String path, String proxyClassName, Class[] interfaces)
Parameter | Description |
---|---|
path | path to save proxy class |
proxyClassName | name of proxy class |
interfaces | interfaces of proxy class |
public static boolean saveProxyClass(String path, String proxyClassName, Class[] interfaces)
//package com.java2s; //License from project: Apache License import java.io.FileOutputStream; import java.io.IOException; import sun.misc.ProxyGenerator; public class Main { /**/*from ww w . java2s . c om*/ * Save proxy class to path * * @param path path to save proxy class * @param proxyClassName name of proxy class * @param interfaces interfaces of proxy class * @return */ public static boolean saveProxyClass(String path, String proxyClassName, Class[] interfaces) { if (proxyClassName == null || path == null) { return false; } // get byte of proxy class byte[] classFile = ProxyGenerator.generateProxyClass(proxyClassName, interfaces); FileOutputStream out = null; try { out = new FileOutputStream(path); out.write(classFile); out.flush(); return true; } catch (Exception e) { e.printStackTrace(); } finally { try { out.close(); } catch (IOException e) { e.printStackTrace(); } } return false; } }