classToByteArray() — netty Function Reference
Architecture documentation for the classToByteArray() function in NativeLibraryLoader.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD b457bef5_b901_945e_103b_a802b8d26790["classToByteArray()"] e940cc67_3be6_5ff3_e560_4d68972dc13b["NativeLibraryLoader"] b457bef5_b901_945e_103b_a802b8d26790 -->|defined in| e940cc67_3be6_5ff3_e560_4d68972dc13b ad07e32d_733a_fab6_069d_362602f3f820["tryToLoadClass()"] ad07e32d_733a_fab6_069d_362602f3f820 -->|calls| b457bef5_b901_945e_103b_a802b8d26790 style b457bef5_b901_945e_103b_a802b8d26790 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java lines 488–508
private static byte[] classToByteArray(Class<?> clazz) throws ClassNotFoundException {
String fileName = clazz.getName();
int lastDot = fileName.lastIndexOf('.');
if (lastDot > 0) {
fileName = fileName.substring(lastDot + 1);
}
URL classUrl = clazz.getResource(fileName + ".class");
if (classUrl == null) {
throw new ClassNotFoundException(clazz.getName());
}
byte[] buf = new byte[1024];
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
try (InputStream in = classUrl.openStream()) {
for (int r; (r = in.read(buf)) != -1;) {
out.write(buf, 0, r);
}
return out.toByteArray();
} catch (IOException ex) {
throw new ClassNotFoundException(clazz.getName(), ex);
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does classToByteArray() do?
classToByteArray() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java.
Where is classToByteArray() defined?
classToByteArray() is defined in common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java at line 488.
What calls classToByteArray()?
classToByteArray() is called by 1 function(s): tryToLoadClass.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free