Libraryless. Click here for Pure Java version (7609L/43K).
1 | sclass InMemoryClassLoader extends ClassLoader { |
2 | transient settable bool rememberClassBytes; |
3 | |
4 | transient Map<Class, byte[]> classBytes = syncMap(); |
5 | |
6 | *(ClassLoader parent) { super(parent); } |
7 | |
8 | Class<?> defineAClass(S name, byte[] bytes) { |
9 | Class c = defineClass(name, bytes, 0, bytes.length); |
10 | if (rememberClassBytes) |
11 | classBytes.put(c, bytes); |
12 | ret c; |
13 | } |
14 | |
15 | byte[] getClassBytes(Class c) { |
16 | ret classBytes.get(c); |
17 | } |
18 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034296 |
Snippet name: | InMemoryClassLoader - allows defining classes directly from byte arrays |
Eternal ID of this version: | #1034296/4 |
Text MD5: | 84d34bffdbc3e8727f5cc06d907c6f6e |
Transpilation MD5: | d8360c9c5fe379cc2e40d0528a875b29 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-29 21:10:14 |
Source code size: | 468 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 251 / 398 |
Version history: | 3 change(s) |
Referenced in: | [show references] |