0 Replies Latest reply on Feb 24, 2006 2:11 AM by wallslide

    Serialization of CtMethod, or alternative

    wallslide

      I am writing a program using Javassist which requires me to encrypt the individual methods of a class. Unfortunately, CtMethod is not serializable, so I can neither use a SealedObject, nor a ObjectOutputStream to encrypt an instance of CtMethod. I see that I can retrieve the code in CtMethod as a byte[] ( ctMethodInstance.getMethodInfo().getCodeAttribute().getCode() ), however I don't see how to create a CtMethod from the array of bytes.

      What would be the easiest way to create a byte[] representing a CtMethod, and then reconstituting the byte[] into a CtMethod?