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, that is, to pass a Class<?>
and get its byte array?
Keep in mind that I'm not talking about serialization!
You can use ClassLoader.getResourceAsInputStream() however it is not guaranteed this will be the same bytes as that which was loaded. I don't believe the actual bytes loaded are stored anywhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With