Converting a given class (let's say, java.lang.Object) to a byte array. Is it possible?

后端 未结 4 1306
栀梦
栀梦 2021-01-13 17:13

Given that class loaders accept to take as input a byte array of a given class, returning a Class, I wonder whether it is possible to do the reverse, t

4条回答
  •  逝去的感伤
    2021-01-13 17:29

    No standard way I know of. But you might implement your own delegating classloader, keeping track of classes loaded in terms of name and bytecode.

    What would be your use case? - Transferring code to a remote application?

提交回复
热议问题