コード例 #1
0
  public static void extractGM(String pathToGMData) {
    String directoryPath = DirectorySettings.getCacheDirectory().getAbsolutePath();
    try {
      File data = new File(pathToGMData);
      ZipFile zipData = new ZipFile(data.getAbsolutePath());
      Enumeration entries = zipData.entries();
      while (entries.hasMoreElements()) {
        ZipEntry entry = (ZipEntry) entries.nextElement();
        if (entry.isDirectory()) {
          (new File(directoryPath + File.separator + entry.getName())).mkdirs();
          continue;
        }

        IOUtils.copy(
            zipData.getInputStream(entry),
            new FileOutputStream(directoryPath + File.separator + entry.getName()));
      }
      zipData.close();
      FileWriter fstream =
          new FileWriter(
              DirectorySettings.getGeneManiaDirectory()
                  + File.separator
                  + DirectorySettings.GENEMANIA_CHECK_FILE);
      BufferedWriter out = new BufferedWriter(fstream);
      out.write("This file indicates that the GeneMANIA data has finished downloading.");
      out.close();
      if (!data.delete()) {
        LOG.error("Couldn't delete GeneMANIA .zip: " + data.getAbsolutePath());
      }

    } catch (IOException ex) {
      java.util.logging.Logger.getLogger(GenemaniaInfoRetriever.class.getName())
          .log(Level.SEVERE, null, ex);
    }
  }
コード例 #2
0
 // returns invalid genes that were not set
 public void setGenes(List<String> geneNames) {
   try {
     this.genes = getValidGenes(geneNames);
   } catch (Exception ex) {
     java.util.logging.Logger.getLogger(GenemaniaInfoRetriever.class.getName())
         .log(Level.SEVERE, null, ex);
   }
 }