Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. @Override
  2. public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined,
  3. ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
  4. System.out.println("Attempting to redefine " + className);
  5. File file = new File(String.format("C:\\Users\\midni\\Desktop\\dump\\%s.class", className));
  6. if(file.exists())
  7. file.delete();
  8. file.getParentFile().mkdirs();
  9. try(FileOutputStream fos = new FileOutputStream(file)) {
  10. fos.write(classfileBuffer);
  11. fos.flush();
  12. fos.close();
  13. } catch (IOException e) {
  14. e.printStackTrace();
  15. }
  16. return null;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement