I am trying to download image from server using CURL. Below is the code I am using.
private void executeCMD(String[] cmd) {
ProcessBuilder process = new ProcessBuilder(cmd);
Process p;
try
{
p = process.start();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
StringBuilder builder = new StringBuilder();
String line = null;
while ( (line = reader.readLine()) != null) {
builder.append(line);
builder.append(System.getProperty("line.separator"));
}
String result = builder.toString();
System.out.print(result);
}
catch (IOException e)
{ System.out.print("error");
e.printStackTrace();
}
}
I can see the binary output(result) on the log files, but its not downloading as image on local drive.