Exemple #1
0
 @Override
 public InputStream getInputStream(ISourceLocation uri) throws IOException {
   String contents = modules.get(uri.getPath());
   if (contents != null) {
     return new ByteArrayInputStream(contents.getBytes());
   }
   return null;
 }
 @Override
 protected String getPath(ISourceLocation uri) {
   String path = uri.getPath();
   if (path == null || path.isEmpty() || path.equals("/")) {
     return "";
   }
   while (path.startsWith("/")) {
     path = path.substring(1);
   }
   return path;
 }
  private JarEntry getEntry(JarInputStream stream, ISourceLocation subPath) throws IOException {
    int pos =
        ((JarInputStreamTreeHierachy) getFileHierchyCache(new File(subPath.getPath())))
            .getPosition(getPath(subPath));

    if (pos != -1) {
      JarEntry entry;
      do {
        entry = stream.getNextJarEntry();
      } while (pos-- > 0);

      return entry;
    }

    return null;
  }
Exemple #4
0
 @Override
 public boolean exists(ISourceLocation uri) {
   return modules.containsKey(uri.getPath());
 }
 @Override
 protected File getJar(ISourceLocation uri) throws IOException {
   return new File(jarURI.getPath());
 }