Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1033453 // byteCodePathForClass_forURLClassLoader (return jar or dir)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4592L/26K).

1  
static File byteCodePathForClass_forURLClassLoader(Class c) ctex {
2  
  if (c == null) null;
3  
  ClassLoader cl = getClassLoader(c);
4  
  
5  
  if (cl cast URLClassLoader) {
6  
    S name = c.getName().replace('.', '/') + ".class";
7  
    var urls = cl.getURLs();
8  
    for (URL url : urls) pcall {
9  
      File location = urlToFile(url);
10  
      temp InputStream in = inputStreamForFileInDirOrZip(location, name);
11  
      if (in != null) ret location;
12  
    }
13  
    fail(name + " not found in: " + urls);
14  
  }
15  
  
16  
  null;
17  
}

Author comment

Began life as a copy of #1033452

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033453
Snippet name: byteCodePathForClass_forURLClassLoader (return jar or dir)
Eternal ID of this version: #1033453/1
Text MD5: 987f9858f57f56425e1958472fa18ca5
Transpilation MD5: b466f17e183564b5bac544848f666b05
Author: stefan
Category: javax / byte code
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-28 18:33:55
Source code size: 509 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 90 / 133
Referenced in: [show references]