I am working on learning Java
and am going through the examples on the Android website. I am getting remote contents of an XML
file. I am able to get the contents of the file, but then I need to convert the InputStream
into a String
.
public String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException {
InputStreamReader reader = null;
reader = new InputStreamReader(stream, "UTF-8");
char[] buffer = new char[len];
reader.read(buffer);
return new String(buffer);
}
The issue I am having is I don't want the string to be limited by the len
var. But, I don't know java
well enough to know how to change this.
How can I create the char
without a length?