I'm doing my API REST and I saw that in a lot of examples people use EntityUtils.toString(response) to get their response into a String from their GET, POST, PUT and DELETE methods. Similar to this:
HttpGet method = new HttpGet(url);
method.setHeader("content-type", "application/json");
HttpResponse response = httpClient.execute(method);
String responseString = EntityUtils.toString(response.getEntity());
PLEASE AVOID ANSWERS THAT SAID TO ME THAT IT GIVES TO ME A STRING
I know that it returns to me a String with the content of an entity (in this case the response) but here is where my doubts come, because I'm not secure about what this String returns. I saw it into the official documentation.
Read the contents of an entity and return it as a String.
It is the content-type what is returned in the String?
On the contrary, are the values that I'm getting with my method what are returned in the String?
I think it is the second one question but I'm not secure about that. And, in the case it is true, how this values are stored into the String? Are they separated by comas or some special character?
Thanks in advance!