Parse given file into the form of frame represented by the given key.

@param okey  destination key for parsed frame
@param files  files to parse
@return a new frame
160227
public static Frame parseFrame(Key okey, File ...files) {
    assert files.length > 0 : "Ups. No files to parse!";
    for (File f : files)
      if (!f.exists())
        throw new RuntimeException("File not found " + f);
    // Create output key if not specified
    if(okey == null)
      okey = Key.make(files[0].getName());

    Key[] fkeys = new Key[files.length];
    int cnt = 0;
    for (File f : files) fkeys[cnt++] = NFSFileVec.make(f);
    return parseFrame(okey, fkeys);
  }
977339
@Pure
	public static File join(File fileBase, File... elements) {
		if (fileBase == null) {
			return null;
		}
		final StringBuilder buf = new StringBuilder(fileBase.getPath());
		for (final File elt : elements) {
			if (!elt.isAbsolute() && buf.length() >= 0 && buf.charAt(buf.length() - 1) != File.separatorChar) {
				buf.append(File.separatorChar);
			}
			buf.append(elt.getPath());
		}
		return new File(buf.toString());
	}
104279
@Override
  public ParseSetup createParserSetup(Key[] inputs, ParseSetup requiredSetup) {

    FileVec f;
    Object frameOrVec = DKV.getGet(inputs[0]);

    if (frameOrVec instanceof water.fvec.Frame)
      f = (FileVec) ((Frame) frameOrVec).vec(0);
    else
      f = (FileVec) frameOrVec;
    return readSetup(f, requiredSetup.getColumnNames(), requiredSetup.getColumnTypes());
  }
711574
function parse_files(files, options, callback) {
  var nodes = {
    // root section node
    '': {
      id: '',
      type: 'section',
      children: [],
      description: '',
      short_description: '',
      href: '#',
      root: true,
      file: '',
      line: 0
    }
  };

  var reportObject = { };
  
  async.forEachSeries(files, function (file, next_file) {
    var fn = parsers[path.extname(file)];

    if (!fn) {
      next_file();
      return;
    }

    console.info('Parsing file: ' + file);
    fn(file, options, function (err, file_nodes, file_report) {
      // TODO:  fail on name clash here as well -- as we might get name clash
      //        from different parsers, or even different files
      _.extend(nodes, file_nodes);
      _.extend(reportObject, file_report);
      next_file(err);
    });
  }, function (err) {
    callback(err, nodes, reportObject);
  });
}
1159859
public Map<String, Map<String, List<BigDecimal>>> parse(final String file) {
		try (BufferedReader reader = new BufferedReader(new InputStreamReader(openResource(file), StandardCharsets.UTF_8))) {
			Map<String, Map<String, List<BigDecimal>>> benchmarks = new TreeMap<>(Collections.reverseOrder());

			for (String line = reader.readLine(); line != null; line = reader.readLine()) {
				Matcher matcher = LINE_PATTERN.matcher(line);
				if (matcher.matches()) {
					String framework = matcher.group(GROUP_FRAMEWORK_NAME);
					String benchmark = matcher.group(GROUP_BENCHMARK_NAME);
					String score = matcher.group(GROUP_SCORE_VALUE);

					if (!frameworks.contains(framework)) {
						Logger.error("Unknown logging framework: \"{}\"", framework);
						return Collections.emptyMap();
					}

					BigDecimal parsedScore = new BigDecimal(score.replaceAll("[,\\.]", "."));

					Map<String, List<BigDecimal>> benchmarkEntry = benchmarks.get(benchmark);
					if (benchmarkEntry == null) {
						benchmarkEntry = new LinkedHashMap<>();
						benchmarks.put(benchmark, benchmarkEntry);
					}

					List<BigDecimal> scores = benchmarkEntry.get(framework);
					if (scores == null) {
						scores = new ArrayList<>();
						benchmarkEntry.put(framework, scores);
					}

					scores.add(parsedScore);
				}
			}

			return benchmarks;
		} catch (IOException ex) {
			Logger.error(ex, "Failed to open \"{}\"", file);
			return Collections.emptyMap();
		}
	}
1157108
public static void copyFiles(File[] files, String storageFolder) throws IOException {
        storageFolder = checkFolder(storageFolder) + ValueConsts.SEPARATOR;
        for (File file : files) {
            copyFile(file, new File(storageFolder + file.getName()));
        }
    }
1079434
public static Key make(FileStatus f) {
    Futures fs = new Futures();
    Key key = make(f, fs);
    fs.blockForPending();
    return key;
  }
1354450
public static void writeInPemFormat(final PrivateKey privateKey, final @NonNull File file)
		throws IOException
	{
		KeyWriter.writeInPemFormat(privateKey, file);
	}
1352447
public static byte[] readFileAtOnce(final File file) throws IOException {
		final FileInputStream fIn = new FileInputStream(file);
		return readFileAtOnce(fIn);
	}
1052044
public static byte[] hash(File file) throws IOException {
    return Files.hash(file, Hashing.md5()).asBytes();
  }
866824
public static void writeInPemFormat(final Key key, final @NonNull File file) throws IOException
	{
		StringWriter stringWriter = new StringWriter();
		JcaPEMWriter pemWriter = new JcaPEMWriter(stringWriter);
		pemWriter.writeObject(key);
		pemWriter.close();
		String pemFormat = stringWriter.toString();
		pemFormat = pemFormat.replaceAll("\\r\\n", "\\\n");
		WriteFileExtensions.string2File(file, pemFormat);
	}
973772
private void openUploadWithFiles(JavaScriptObject files) {

        JsArray<CmsFileInfo> cmsFiles = files.cast();
        List<CmsFileInfo> fileObjects = new ArrayList<CmsFileInfo>();
        for (int i = 0; i < cmsFiles.length(); ++i) {
            fileObjects.add(cmsFiles.get(i));
        }
        CmsDialogUploadButtonHandler buttonHandler = new CmsDialogUploadButtonHandler(
            new Supplier<I_CmsUploadContext>() {

                /**
                 * @see com.google.common.base.Supplier#get()
                 */
                public I_CmsUploadContext get() {

                    return new I_CmsUploadContext() {

                        public void onUploadFinished(List<String> uploadedFiles) {

                            uploadFinished(uploadedFiles);
                        }

                    };
                }
            });
        buttonHandler.setIsTargetRootPath(true);
        buttonHandler.setTargetFolder(getState().getTargetFolderRootPath());
        buttonHandler.openDialogWithFiles(fileObjects);
    }
1020047
public void put(final File file, final String key, String token, final UpCompletionHandler complete,
                    final UploadOptions options) {
        final UpToken decodedToken = UpToken.parse(token);
        if (areInvalidArg(key, null, file, token, decodedToken, complete)) {
            return;
        }

        Zone z = config.zone;
        z.preQuery(token, new Zone.QueryHandler() {
            @Override
            public void onSuccess() {
                long size = file.length();
                if (size <= config.putThreshold) {
                    FormUploader.upload(client, config, file, key, decodedToken, complete, options);
                    return;
                }
                String recorderKey = config.keyGen.gen(key, file);
                final WarpHandler completionHandler = warpHandler(complete, file != null ? file.length() : 0);
                ResumeUploader uploader = new ResumeUploader(client, config, file, key,
                        decodedToken, completionHandler, options, recorderKey);

                AsyncRun.runInMain(uploader);
            }

            @Override
            public void onFailure(int reason) {
                final ResponseInfo info = ResponseInfo.isStatusCodeForBrokenNetwork(reason) ?
                        ResponseInfo.networkError(reason, decodedToken) :
                        ResponseInfo.invalidToken("invalid token");
                complete.complete(key, info, null);
            }
        });

    }
368407
@Override
    public byte[] get(String key) {
        File f = new File(directory, hash(key));
        FileInputStream fi = null;
        byte[] data = null;
        int read = 0;
        try {
            if (outOfDate(f)) {
                f.delete();
                return null;
            }
            data = new byte[(int) f.length()];
            fi = new FileInputStream(f);
            read = fi.read(data);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (fi != null) {
            try {
                fi.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        if (read == 0) {
            return null;
        }
        return data;
    }
370908
private FileMetadata loadIntern(final FileCacheKey key) throws IOException {
      final String fileName = key.getFileName();
      final long fileLength = directory.fileLength(fileName);
      // We're forcing the buffer size of a to-be-read segment to the full file size:
      final int bufferSize = (int) Math.min(fileLength, (long)autoChunkSize);
      final FileMetadata meta = new FileMetadata(bufferSize);
      meta.setSize(fileLength);
      return meta;
   }
1352626
public void note(JavaFileObject file, String key, Object ... args) {
        note(file, diags.noteKey(key, args));
    }
706391
public Object getFileMetadata(String file, String key) {
    Map<String, Object> fileKeys = fileLevel.get(file);
    if (fileKeys == null) {
      return null;
    }

    return fileKeys.get(key);
  }