Package org.xmlvm.util.universalfile

Examples of org.xmlvm.util.universalfile.UniversalFile


  }

  private static Map<String, UniversalFile> initializeProxies()
  {
    Map<String, UniversalFile> result= new HashMap<String, UniversalFile>();
    UniversalFile basePath= UniversalFileCreator.createDirectory(BIN_PROXIES_ONEJAR_PATH, BIN_PROXIES_PATH);

    // If not proxies are available, we disable proxy replacement.
    if (basePath == null)
    {
      Log.debug(TAG, "Proxies not loaded, therefore there will be no proxy replacement");
      return result;
    }

    final String classEnding= ".class";
    UniversalFileFilter classFilter= new FileSuffixFilter(classEnding);
    for (UniversalFile proxyFile : basePath.listFilesRecursively(classFilter))
    {
      String proxyFileName= proxyFile.getRelativePath(basePath.getAbsolutePath());
      String proxyTypeName= proxyFileName.substring(0, proxyFileName.length() - (classEnding.length())).replace(File.separatorChar, '.');
      result.put(proxyTypeName, proxyFile);
    }
    return result;
  }
View Full Code Here


    return true;
  }

  protected UniversalFile[] getLibraryUncached()
  {
    UniversalFile android= UniversalFileCreator.createDirectory(ONE_JAR_LOCATION, prepareTempJar(FILE_SYSTEM_LOCATION, ""));
    UniversalFile common= UniversalFileCreator.createDirectory(ONE_JAR_LOCATION, prepareTempJar(COMMON_FILE_SYSTEM_LOCATION, ""));
    UniversalFile iphone= UniversalFileCreator.createDirectory(ONE_JAR_LOCATION, prepareTempJar(IPHONE_FILE_SYSTEM_LOCATION, ""));

    return new UniversalFile[] { android, common, iphone };
  }
View Full Code Here

  static Arguments arguments= new Arguments(args);
  static DEXmlvmOutputProcess deXmlvmOutputProcess= new DEXmlvmOutputProcess(arguments);

  public static String transformClassFileToJs(File file, boolean write)
  {
    UniversalFile universalFile= UniversalFileCreator.createFile(file);
    return transformFile(file.getName(), universalFile, write);
  }
View Full Code Here

   * Performs the hierarchy analysis and returns the result.
   */
  public TypeHierarchy analyze()
  {
    // Extract all class files.
    UniversalFile library= UniversalFileCreator.createDirectory(null, libraryPath);
    UniversalFile[] classes= library.listFilesRecursively(new UniversalFileFilter()
    {

      public boolean accept(UniversalFile file)
      {
        return file.getName().toLowerCase().endsWith(".class");
      }
    });
    System.out.println("Getting type hierarchy for " + classes.length + " classes.");

    TypeHierarchy result= new TypeHierarchy();
    final String basePath= library.getAbsolutePath();
    for (UniversalFile clazz : classes)
    {
      String fileName= clazz.getRelativePath(basePath).replace('\\', '.');
      DirectClassFile classFile= new DirectClassFile(clazz.getFileAsBytes(), fileName, false);
      classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
View Full Code Here

    else
    {
      // If there is no stored result, we nee to analyze the classes
      // first.
      // First the class files are loaded.
      UniversalFile library= UniversalFileCreator.createDirectory(null, jdkFileName);
      UniversalFile[] classes= library.listFilesRecursively(new UniversalFileFilter()
      {

        public boolean accept(UniversalFile file)
        {
          return file.getName().toLowerCase().endsWith(".class");
        }
      });
      Log.debug(TAG, "Analyzing " + classes.length + " classes.");
      final String basePath= library.getAbsolutePath();

      // We go through all the class files and get their dependencies.
      for (UniversalFile clazz : classes)
      {
        String fileName= clazz.getRelativePath(basePath).replace('\\', '.');
View Full Code Here

    }
  }

  private static String readFromFile(String path)
  {
    UniversalFile file= UniversalFileCreator.createFile(new File(path));
    if (!file.exists())
    {
      System.err.println("File doesn't exist: " + path);
      return null;
    }
    return file.getFileAsString();
  }
View Full Code Here

      return cachedResourceBytes.get(cacheKey);
    }

    // If we don't have the bytes cached in memory, try to read it from
    // disk.
    UniversalFile file= cachedResources.get(cacheKey);
    if (file == null)
    {
      return null;
    }
    byte[] bytes= file.getFileAsBytes();
    cachedResourceBytes.put(cacheKey, bytes);
    return bytes;
  }
View Full Code Here

    return true;
  }

  protected UniversalFile[] getLibraryUncached()
  {
    UniversalFile android= UniversalFileCreator.createDirectory(ONE_JAR_LOCATION, prepareTempJar(FILE_SYSTEM_LOCATION, ""));
    UniversalFile common= UniversalFileCreator.createDirectory(ONE_JAR_LOCATION, prepareTempJar(COMMON_FILE_SYSTEM_LOCATION, ""));
    UniversalFile sdl= UniversalFileCreator.createDirectory(ONE_JAR_LOCATION, prepareTempJar(SDL_FILE_SYSTEM_LOCATION, ""));
    return new UniversalFile[] { android, common, sdl };
  }
View Full Code Here

    addSupportedInput(ClassInputProcess.class);
    addSupportedInput(JavaByteCodeOutputProcess.class);

    if (redTypes == null)
    {
      UniversalFile redlist= RED_LIST_FILE;
      if (arguments.option_redlist() != null)
      {
        redlist= UniversalFileCreator.createFile(new File(arguments.option_redlist()));
      }
      redTypes= ClassListLoader.loadRedlist(redlist);//initializeClassList(redlist);
    }

    if (greenTypes == null && arguments.option_greenlist() != null)
    {
      greenTypes= ClassListLoader.loadGreenlist(UniversalFileCreator.createFile(new File(arguments.option_greenlist())));
      UniversalFile defaultGreenList= UniversalFileCreator.createFile("/lib/greenlist.txt", "lib/greenlist.txt");
      if (defaultGreenList != null)
      { // Add defaults, if they have been packaged
        greenTypes.addAll(ClassListLoader.loadGreenlist(defaultGreenList));
      }
    }
View Full Code Here

TOP

Related Classes of org.xmlvm.util.universalfile.UniversalFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.