Guest User

Untitled

a guest
Apr 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. } else if(path.startsWith("file:")) {
  2. String filePath = path.substring(5, path.indexOf("!"));
  3. String internalPath = path.substring(path.indexOf("!") + 2);
  4.  
  5. if (!new File(filePath).exists()) {
  6. throw new FileNotFoundException(path);
  7. }
  8.  
  9. JarFile jf = new JarFile(filePath);
  10. ZipEntry zf = jf.getEntry(internalPath);
  11.  
  12. if(zf == null) {
  13. throw new FileNotFoundException(path);
  14. }
  15.  
  16. InputStream is = jf.getInputStream(zf);
  17. // FIXME: don't use RubyIO for this
  18. return new ChannelDescriptor(Channels.newChannel(is), RubyIO.getNewFileno(), flags, new FileDescriptor());
Add Comment
Please, Sign In to add comment