Package net.sf.cglib.asm

Examples of net.sf.cglib.asm.ClassWriter.toByteArray()


            cw.visitEnd();
        }

        cw.visitEnd();

        return cw.toByteArray();
    }

    private class GenericProxyClassLoader extends ClassLoader {
        public Class defineClass(byte[] byteArray) {
            try {
View Full Code Here


/*     */           }
/*  51 */           return v;
/*     */         }
/*     */       };
/*  54 */       new ClassReader(b).accept(w, false);
/*  55 */       return w.toByteArray();
/*     */     } catch (Exception e) {
/*  57 */       System.err.println("failed to patch ClassLoader:");
/*  58 */       e.printStackTrace();
/*  59 */     }return b;
/*     */   }
View Full Code Here

/*     */     try
/*     */     {
/*     */       ClassReader r;
/*  90 */       ClassWriter w = new DebuggingClassWriter(true);
/*  91 */       getGenerator(r).generateClass(w);
/*  92 */       byte[] b = w.toByteArray();
/*  93 */       Class c = super.defineClass(name, b, 0, b.length, DOMAIN);
/*  94 */       postProcess(c);
/*  95 */       return c;
/*     */     } catch (RuntimeException e) {
/*  97 */       throw e;
View Full Code Here

/* 21 */   public static final DefaultGeneratorStrategy INSTANCE = new DefaultGeneratorStrategy();
/*    */
/*    */   public byte[] generate(ClassGenerator cg) throws Exception {
/* 24 */     ClassWriter cw = getClassWriter();
/* 25 */     transform(cg).generateClass(cw);
/* 26 */     return transform(cw.toByteArray());
/*    */   }
/*    */
/*    */   protected ClassWriter getClassWriter() throws Exception {
/* 30 */     return new DebuggingClassWriter(true);
/*    */   }
View Full Code Here

/*     */       }
/*  95 */       new TransformingClassGenerator(new ClassReaderGenerator(getClassReader(file), attributes(), skipDebug()), t).generateClass(w);
/*     */
/*  98 */       FileOutputStream fos = new FileOutputStream(file);
/*     */       try {
/* 100 */         fos.write(w.toByteArray());
/*     */       } finally {
/* 102 */         fos.close();
/*     */       }
/*     */     }
/*     */   }
View Full Code Here

/* 230 */         log("processing " + name[0]);
/*     */       }
/* 232 */       new TransformingClassGenerator(new ClassReaderGenerator(new ClassReader(new ByteArrayInputStream(bytes)), attributes(), skipDebug()), t).generateClass(w);
/*     */
/* 235 */       ByteArrayOutputStream out = new ByteArrayOutputStream();
/* 236 */       out.write(w.toByteArray());
/* 237 */       return out.toByteArray();
/*     */     }
/* 239 */     return bytes;
/*     */   }
/*     */
View Full Code Here

/* 33 */         return abyte;
/* 34 */       ClassWriter w = new DebuggingClassWriter(true);
/* 35 */       ClassGenerator gen = new ClassReaderGenerator(new ClassReader(abyte), false);
/* 36 */       gen = new TransformingClassGenerator(gen, t);
/* 37 */       gen.generateClass(w);
/* 38 */       return w.toByteArray(); } catch (Exception e) {
/*    */     }
/* 40 */     throw new CodeGenerationException(e);
/*    */   }
/*    */
/*    */   protected abstract ClassTransformer getClassTransformer(String paramString);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.