I have a problem and I hope you can help me. The problem is the following. I have a camera that has an http service, and I am communicating with the camera using the http. So I send http request and I receive an http response in which I have a binary jpeg data. But I do not know how to convert that data into picture. So my question, and my main problem is how can I convert that binary data into picture.
This is my code so far, I am stuck in getting the image.
URL url = new URL("http://10.10.1.154" + GETIMAGESCR());
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
// while ((inputLine = in.readLine()) != null){
// inputLine = in.readLine();
File file = new File("D:\\alphas\\proba.bin");
boolean postoi = file.createNewFile();
FileWriter fstream = new FileWriter("D:\\alphas\\proba.bin");
BufferedWriter out = new BufferedWriter(fstream);
while ((inputLine = in.readLine()) != null){
out.write(in.readLine());
// out.close();
// System.out.println("File created successfully.");
System.out.println(inputLine);
}
System.out.println("File created successfully.");
out.close();
in.close()
;