in SamplesV1/CustomizedJavaOnHDInsight/HDInsight-ADF/src/com/adf/jobonhdi/JobOnHdiLauncher.java [303:335]
private static void HdfsCopy(String filePath, String destinationPath, boolean isWindowsOs) throws Exception
{
List<String> commands = new ArrayList<String>();
if (isWindowsOs)
{
commands.add("cmd");
commands.add("/c");
}
else
{
commands.add("/bin/sh");
commands.add("-c");
}
commands.add("hadoop fs -copyToLocal " + filePath + " " + destinationPath);
System.out.println("Start copying : " + commands.get(2));
ProcessBuilder pb = new ProcessBuilder(commands);
Process copyProcess = pb.start();
int result = copyProcess.waitFor();
if (result != 0)
{
System.err.println("'" + filePath + "' is not a valid Azure storage blob. Please use format wasb://storage_url/container_name/blob_name.");
RedirectProcessResult(copyProcess.getErrorStream(), System.err);
throw new RuntimeException("Failed to copy " + filePath);
}
else
{
System.out.println(filePath + " is copied successfully!");
RedirectProcessResult(copyProcess.getInputStream(), System.out);
}
}